什么时候才能有空做算法啊…哎
class Solution {
HashSet<String> set=new HashSet<>();
public boolean reorderedPowerOf2(int n) {
set=new HashSet<>();
init();
return set.contains(count(n));
}
public void init(){
for(int i=1;i<=1e9;i=i<<1){
set.add(count(i));
}
}
public String count(int n){
char[] cs=new char[10];
while(n>0){
cs[n%10]++;
n=n/10;
}
return new String(cs);
}
}