Given an integer n, return true if n is a power of two (that is, n = 2^k for some non-negative integer k), otherwise return false.
Example 1: Input: n = 16 Output: true
Example 2: Input: n = 18 Output: false
Constraints: -1000000 <= n <= 1000000
Given an integer n, return true if n is a power of two (that is, n = 2^k for some non-negative integer k), otherwise return false.
Example 1: Input: n = 16 Output: true
Example 2: Input: n = 18 Output: false
Constraints: -1000000 <= n <= 1000000
Copyright 2026 Stack Duel. All rights reserved.
Input 1 (integer)
18
Output 1 (boolean)
false