Is Power of Four
Solution ApproachWas this helpful?
Easy•bits•Expected: O(1) time, O(1) space
bit-manipulation
Problem
Given an integer, determine whether it is a power of four.
Example 1:
Input: n = 16
Output: true
Explanation: 16 = 4^2
Example 2:
Input: n = 5
Output: false
Example 3:
Input: n = 1
Output: true
Explanation: 4^0 = 1
Reference solution unlocks after your first submission
Loading...
