Reordered Power of 2 | Beats 100% | C++
The steps for solution to this problem are :\n Store all the powers of 2 in a vector\n Compare each numbner in vector with the given number to check if both hav
The steps for solution to this problem are :\n* Store all the powers of 2 in a vector\n* Compare each numbner in vector with the given number to check if both have same digits .\n* If both have same digits , return true\n* else return false .\nPls upvote if u feel it is correct and suggest if it can be improved .\n\n\n```\nclass Solution {\npublic:\n    int comp(int a,int b)\n    {\n        bool A[10]={0},B[10]={0};\n        int lena=0,lenb=0;\n        while(a>0 || b>0)\n        {\n            if(a>0)\n            {\n                A[a%10]=1;\n                a/=10;\n                lena++;\n            }\n            if(b>0)\n            {\n                B[b%10]=1;\n                b/=10;\n                lenb++;\n            }\n        }\n        \n        if(lena!=lenb)\n            return false;\n        \n        for(int i=0 ;i<10 ;i++)\n            if(A[i]!=B[i])\n                return false;\n        return true;\n    }\n    \n    bool reorderedPowerOf2(int N) {\n        int k=1;\n        vector<int> v;\n        for(int i=0 ;i<30 ;i++)\n        {\n            v.push_back(k);\n            k*=2;\n        }\n        \n        for(int i=0 ;i<=30 ;i++)\n        {\n            if(comp(N,v[i]))\n                return true;\n        }\n        return false;\n    }\n};\n```
['C']