Search topics...

Is Power of Four

easy
bitsTime: O(1)Space: O(1)Frequency: 3

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
bit-manipulation