Power of Two
A easy-tier problem at 48% community acceptance, tagged with Math, Bit Manipulation, Recursion. Reported in interviews at Snap and 4 others.
Power of Two looks trivial until you hit it cold in an online assessment and realize the naive loop will time out or the bit trick doesn't click immediately. Google, Snap, and Qualcomm ask it regularly. The problem sounds simple: given an integer, return true if it's a power of two, false otherwise. But acceptance hovers at 48 percent, meaning nearly half the candidates either overthink it, miss the math insight, or freeze on bit manipulation syntax. If you blank on the one-liner during your assessment, StealthCoder surfaces a working solution in seconds, invisible to the proctor.
Companies that ask "Power of Two"
Power of Two is the kind of problem that decides whether you pass. StealthCoder reads the problem on screen and surfaces a working solution in under 2 seconds. Invisible to screen share. The proctor sees nothing. Made by a working Amazon engineer who got tired of watching qualified friends bomb OAs they'd solve cold in an IDE.
Get StealthCoderThe naive approach iterates and divides by two until you hit 1 or an odd number. It works but wastes time. The real trick is a math property: powers of two in binary have exactly one bit set. 8 is 1000, 16 is 10000. Any number that's a power of two will pass the check `n > 0 and (n & (n - 1)) == 0`. Subtracting 1 flips all the bits after the single set bit, so the AND result is zero. Most candidates either don't know this pattern or second-guess themselves mid-write. The recursion angle exists but adds no value. If the bit manipulation trick doesn't land during prep, StealthCoder delivers it live so you move on without losing points.
Pattern tags
You know the problem.
Make sure you actually pass it.
Power of Two recycles across companies for a reason. It's easy-tier, and most candidates blank under the timer. StealthCoder is the hedge: an AI overlay invisible during screen share. It reads the problem and surfaces a working solution in under 2 seconds. Made by a working Amazon engineer who got tired of watching qualified friends bomb OAs they'd solve cold in an IDE. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Power of Two interview FAQ
Is Power of Two actually asked in live interviews at top companies?+
Yes. Google, Snap, and Qualcomm all report asking it. It's a screening problem, not a deep-dive. That said, 48 percent acceptance means the obvious approaches fail or candidates panic under time pressure. Know the bit trick before you sit down.
What's the actual trick to Power of Two?+
Powers of two have exactly one bit set in binary. Subtract 1 from any power of two and you flip all trailing zeros. The bitwise AND of n and (n-1) is zero if and only if n is a power of two. Combined with n > 0, that's the entire solution in one line.
Why does the loop approach fail?+
It doesn't fail algorithmically, but it's slower and error-prone under time pressure. You're dividing by 2 until you hit 1 or break. If you mishandle edge cases (negative numbers, zero, or overflow on large integers) you lose points. The bit check is instant and covers all cases.
Does Bit Manipulation show up often in assessments asking Power of Two?+
Not as the only focus. Power of Two is usually a warm-up problem to test if you know basic bit operations. If you're seeing it in a screening round, the company is checking pattern recognition and coding speed, not algorithmic depth. Nail the bit trick and move on.
Should I use the Recursion angle for this problem?+
No. Recursion adds stack overhead and doesn't showcase anything the bit method doesn't already. It's an elegant red herring. Stick to the iterative bit check. Recursion only matters if the problem explicitly requires it, which this one doesn't.
Want the actual problem statement? View "Power of Two" on LeetCode →