231-Power-Of-Two

Sat 17 May 2025

https://leetcode.com/problems/power-of-two

import pyutil as pyu
pyu.get_local_pyinfo()
print(pyu.ps2("python-dotenv"))
from typing import List
class Solution:
  def isPowerOfTwo(self, n: int) -> bool:
    return False if n < 0 else bin(n).count('1') == 1
new Solution().isPowerOfTwo()

Score: 5

Category: leetcode