Search topics...
All Problems

Is Power of Four

Solution Approach
Was this helpful?
EasybitsExpected: 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...