Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 862adeb

Browse files
committed
Time: 1613 ms (19.47%) | Memory: 89 MB (17.56%) - LeetSync
1 parent c6b7234 commit 862adeb

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
class Solution:
2+
def reorderedPowerOf2(self, n: int) -> bool:
3+
from itertools import permutations
4+
5+
nums = list(str(n))
6+
7+
for p in set(permutations(nums)):
8+
if p[0] != "0":
9+
if int("".join(p)) & (int("".join(p)) - 1) == 0:
10+
return True
11+
return False

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /