Search⌘ K
AI Features

Solution: Power of Four

C# solution for the Power of Four problem using the Bitwise Manipulation pattern.

Statement

Given an integer n, return true if n is a power of four. Otherwise, return false.

A number is a power of four if there exists an integer x such that n = 4^x.

Note: Follow up: can you solve it without using loops or recursion?

Constraints:

  • 231-2^{31} \leq ...