Leetcode 231. Power of Two
Determine whether a given 32-bit integer n is a power of two (i.e., n == 2^x for some integer x), returning false for non-positive values. A common O(1) approach uses a bit-manipulation pattern to check this without loops.
Asked at:
Meta
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
Early August, 2024
Meta
Senior
Your account is free and you can post anonymously if you choose.