✅✅Faster || Easy To Understand || C++ Code
Using Hashmap\n\n Time Complexity :- O(Constant * logN)\n\n Space Complexity :- O(Constant)\n\n\nclass Solution {\npublic:\n    \n    // function for checking i
* ***Using Hashmap***\n\n* ***Time Complexity :- O(Constant * logN)***\n\n* ***Space Complexity :- O(Constant)***\n\n```\nclass Solution {\npublic:\n    \n    // function for checking is two numbers have identiacal digits\n    \n    bool is_possible(int num1, int num2)\n    {\n        vector<int> mp(10, 0);\n        \n        // increment the count of digits by num1 \n        \n        while(num1)\n        {\n            int r = num1 % 10;\n            \n            mp[r]++;\n            \n            num1 = num1 / 10;\n        }\n        \n        // decrement the count of digits by num2\n        \n        while(num2)\n        {\n            int r = num2 % 10;\n            \n            mp[r]--;\n            \n            num2 = num2 / 10;\n        }\n        \n        // check if both are idenical of not\n        \n        for(int i = 0; i < 10; i++)\n        {\n            if(mp[i] != 0)\n                return false;\n        }\n        \n        return true;\n    }\n    \n    bool reorderedPowerOf2(int n) {\n        \n        // first of all find all the power of 2 <= 1e9 and store in power array\n        \n        int num = 1;\n        \n        vector<int> power;\n        \n        power.push_back(1);\n        \n        while(num * 2 <= 1e9)\n        {\n            power.push_back(num * 2);\n            \n            num = num * 2;\n        }\n        \n        // compare the number with every element of power array, if any of them have the identical digits \n        \n        // then we can reorder the number to power of 2\n        \n        for(int i = 0; i < power.size(); i++)\n        {\n            if(is_possible(power[i], n))\n                return true;\n        }\n        \n        return false;\n    }\n};\n```
['C', 'Counting', 'C++']