Tap here to switch tabs
Problem
Submissions

Problem: Power of Four

med
30 min
Try to solve the Power of Four problem.

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 n ≤231−1\leq 2^{31} - 1

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Power of Four

med
30 min
Try to solve the Power of Four problem.

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 n ≤231−1\leq 2^{31} - 1