Description

Given an integer n, return true if it is a power of two. Otherwise, return false. An integer n is a power of two, if there exists an integer x such that n == 2^x.

Examples

Input:n = 1
Output:true
Explanation:

2^0 = 1

Input:n = 16
Output:true
Explanation:

2^4 = 16

Input:n = 3
Output:false
Explanation:

3 is not a power of 2.

Constraints

  • -2³¹ ≤ n ≤ 2³¹ - 1

Ready to solve this problem?

Practice solo or challenge other developers in a real-time coding battle!