power-of-four-subset-of-power-of-two

Status: IN

The first two conditions in `isPowerOfFour` (`n > 0` and `n & (n-1) == 0`) are exactly the power-of-two check; the third condition (`n & 0x55555555 != 0`) narrows from powers-of-two to powers-of-four by requiring the set bit at an even position.

Source: entries/2026/06/06/power-of-four-solution.md

JSON