Given an integer n, return true if it is a power of two, and false otherwise.
An integer n is a power of two if there exists an integer k such that n == 2^k. Note that 1 is a power of two (2^0 = 1). Zero and negative numbers are never powers of two.
n = 1truen = 16truen = 3false-2^31 <= n <= 2^31 - 1Run your code to see results
Use Cmd+Enter to run