Back to DSA

Power of Two

medium
Acceptance: 43%
Bit ManipulationMath

Determine whether a given integer is an exact power of two. An integer n qualifies if there exists some non-negative integer k such that 2^k equals n.

Examples

Example 1:
Input:n = 8
Output:true
Example 2:
Input:n = 10
Output:false

Hints

00:00
1234567