Skip to content

Solution Review: Power of 2

Let's solve this using brain kernighan's algorithm. This is optimized to O(1) time and space.

Data Structures and Algorithms Bit Manipulation
Gopi Gorantala