1
class Solution {
2
public boolean reorderedPowerOf2(int n) {
3
int[] countN = count(n);
4
int num = 1;
5
for (int i = 0; i < 31; i++) {
6
if (Arrays.equals(countN, count(num))) {
7
return true;
8
}
9
num = num << 1;
10
}
11
return false;
12
}
13

14
int[] count(int n) {
15
int[] arr = new int[10];
16
while (n > 0) {
17
arr[n % 10]++;
18
n /= 10;
19
}
20
return arr;
21
}
22
}

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0