✅ Q869.C++ || 100% time & space || fast & easy
C++ Code:\n\n    bool isEqual(int arr1[10], int arr2[10]) {\n        for (int i = 0; i < 10; i++) if (arr1[i] != arr2[i]) return 0;\n        return 1;\n    }\n\
C++ Code:\n```\n    bool isEqual(int arr1[10], int arr2[10]) {\n        for (int i = 0; i < 10; i++) if (arr1[i] != arr2[i]) return 0;\n        return 1;\n    }\n\n    int countDigits(int num, int digits[10]) {\n        int cnt = 0;\n        while (num > 0) digits[num % 10]++, num /= 10, cnt++;\n        return cnt;\n    }\n\n    bool reorderedPowerOf2(int num) {\n        if (num > 0) {\n            int numDigits[10] = { 0 }, numCnt = countDigits(num, numDigits);\n            long po2 = 1; // po2: Power of 2\n            while (1) {\n                int po2Digits[10] = { 0 }, po2Cnt = countDigits(po2, po2Digits);\n                po2 <<= 1; // same as (po2 = po2 * 2;)\n                if (po2Cnt < numCnt) continue;\n                if (po2Cnt > numCnt || po2 > INT_MAX) break;\n                if (isEqual(numDigits, po2Digits)) return 1;\n            }\n        }\n        return 0;\n    }\n```\n**The complexity of this solution:**\n-\tTime: O( n^2 ) // depend on the size of num and po2\n-\tSpace: O( 1 ) // constant array size\n\nResult: \n![image](https://assets.leetcode.com/users/images/bceeb8be-3eb7-4c31-8d01-2517b3102621_1661493958.3626537.png)\n**If you loved this solution please up vote, enjoy your coding \uD83D\uDE0A\uD83D\uDE0A**
['C', 'C++']