mirror of
https://github.com/devenperez/leetcode.git
synced 2026-06-13 14:57:08 +00:00
5 lines
140 B
Python
5 lines
140 B
Python
class Solution:
|
|
def isPowerOfTwo(self, n: int) -> bool:
|
|
if n < 0:
|
|
return False
|
|
return bin(n).count("1") == 1 |