Power of Four
Return True if n is a power of 4 (1, 4, 16, 64, ...), otherwise False.
Example 1
n 16
returns true
4 squared.
Example 2
n 8
returns false
8 is a power of 2 but not of 4.
Constraints
-231 <= n <= 231 - 1
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.
More Math problems
- Power of ThreeBeginner
- Power of TwoBeginner
- Product Minus Sum of DigitsBeginner
- Seconds to ClockBeginner
- Staircase of StonesBeginner
- Steps to Reduce to ZeroBeginner
- Sum of Consecutive PowersBeginner
- Sum of DivisorsBeginner