diff --git a/LeetCode/0869_Reordered_Power_of_2.py b/LeetCode/0869_Reordered_Power_of_2.py new file mode 100644 index 0000000..1c58eb3 --- /dev/null +++ b/LeetCode/0869_Reordered_Power_of_2.py @@ -0,0 +1,15 @@ +import math +import itertools +class Solution(object): + def reorderedPowerOf2(self, N): + """ + :type N: int + :rtype: bool + """ + nums = ["".join(x) for x in list(itertools.permutations(list(str(N))))] + for n in nums: + if n[0]!='0': + a = int(math.log(int(n),2)) + if 2**a == int(n): + return True + return False