Given an integer n, return true if it is a power of two. Otherwise return false.
n
true
false
n = 1
Why
2⁰ = 1
n = 3
-2^31 <= n <= 2^31 - 1
Topics
Implement isPowerOfTwo in the editor and return the answer — printing it is never graded.
isPowerOfTwo
Problem 41 of 1146 in the arena