1class Solution {2public:3bool reorderedPowerOf2(int n) {4string str = to_string(n);5sort(str.begin(), str.end());6long long int num;7int counter = 0;89while (true) {10num = pow(2, counter++);1112string temp = to_string(num);1314if (temp.length() > str.length()) {15// cout<<"temp="<<temp<<endl;16break;17}1819sort(temp.begin(), temp.end());2021if (str == temp) return true;22}23return false;24}25};