Given an integer , return true if is a power of two. Otherwise, return false. An integer is a power of two if there exists an integer such that .
Examples: (which is ), , , , are powers of two. , , , are not. What property do powers of two have in binary?
Look at the binary: , , , , . Every power of two has exactly one 1 bit. Non-powers have multiple 1 bits. How can you check for exactly one 1 bit?