Easy · Math
Power of two
Given an integer n, return true if n is a power of two (n = 2^k for some integer k ≥ 0), and false otherwise.
Examples
Example 1
n = 16 (power of two)Output: 16 is a power of two
Example 2
n = 6 (not power of two)Output: 6 is not a power of two
Rebuild it in the studio
Open every published interview problem, solution, scene, and memory room free, with no account.