Skip to content

Commit

Permalink
Time: 35 ms (84.07%), Space: 16 MB (99.16%) - LeetHub
Browse files Browse the repository at this point in the history
  • Loading branch information
hovanhoa committed Oct 23, 2023
1 parent 2532487 commit 6ff8d1f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions 0342-power-of-four/0342-power-of-four.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
class Solution:
def isPowerOfFour(self, n: int) -> bool:
mask = 0x55555555
return n > 0 and (n & (n - 1)) == 0 and (n & mask) == n

0 comments on commit 6ff8d1f

Please sign in to comment.