11.10 Power of Two
11.10.1 Problem Metadata
- Platform: Firecode.io
- Problem ID: Power of Two
- Difficulty: Level 2
- URL: https://www.firecode.io/
- Tags:
- Techniques: Recursion, Math, Bit Manipulation
11.10.5 Solution 1 - Recursive Halving
11.10.5.1 Walkthrough
Repeatedly divide n by 2 as long as it is even. If we reach 1, n is a power of two; if we encounter an odd number (other than 1) or zero, it is not.