C++ | Efficient Solution | Easy
\nbool reorderedPowerOf2(int n) {\n        \n    if(n==1)\n        return true;\n    \n    string num = to_string(n);\n    sort(num.begin(),num.end());\n    \n 
```\nbool reorderedPowerOf2(int n) {\n        \n    if(n==1)\n        return true;\n    \n    string num = to_string(n);\n    sort(num.begin(),num.end());\n    \n    unordered_map<string,int> powers;\n    \n    //creating all 0 to 29 possible powers of 2;\n    for(int i =0 ; i<=29; i++){\n        string str = to_string((int)pow(2,i));      //pow function returns float so we need to convert\n        sort(str.begin(),str.end());\n        powers[str] = 1;\n    }        \n    \n    if(powers[num]==1)\n        return 1;\n    else\n        return 0;\n    \n}\n};\n```
['C']