Leetcode 900 Solution
This article provides solution to leetcode question 900 (reordered-power-of-2)
Access this page by simply typing in "lcs 900" in your browser address bar if you have bunnylol configured.
Leetcode Question Link
https://leetcode.com/problems/reordered-power-of-2
Solution
class Solution:
def reorderedPowerOf2(self, N: int) -> bool:
k = 1
while len(str(k)) <= len(str(N)):
if sorted(str(k)) == sorted(str(N)):
return True
k *= 2
return False