Solution
C++ []\nclass Solution {\n public:\n  bool reorderedPowerOf2(int N) {\n    int count = counter(N);\n\n    for (int i = 0; i < 30; ++i)\n      if (counter(1 << i
```C++ []\nclass Solution {\n public:\n  bool reorderedPowerOf2(int N) {\n    int count = counter(N);\n\n    for (int i = 0; i < 30; ++i)\n      if (counter(1 << i) == count)\n        return true;\n\n    return false;\n  }\n private:\n  int counter(int n) {\n    int count = 0;\n\n    for (; n > 0; n /= 10)\n      count += pow(10, n % 10);\n\n    return count;\n  }\n};\n```\n\n```Python3 []\nclass Solution:\n    def reorderedPowerOf2(self, n: int) -> bool:\n\n        t = sorted(str(n))\n        i = 0\n        while len(str(2**i))<=len(str(n)):\n            if t==sorted(str(2**i)):\n                return True\n            i+=1\n        return False\n```\n\n```Java []\nclass Solution {\n    static byte[][] ocurr;\n    public boolean reorderedPowerOf2(int n) {\n        if (n == 1) return true;\n        if (ocurr == null) {\n            ocurr = fillOccurencesForEachPowerOf2();\n        }\n        byte[] freq = countFreqs(n);\n        for (byte[] oc : ocurr) {\n            if (areSame(oc, freq)) {\n                return true;\n            }\n        }\n        return false;\n    }\n    private byte[][] fillOccurencesForEachPowerOf2() {\n        byte[][] res = new byte[30][10];\n        for (int i = 0; i < res.length; i++) {\n            int pow = (int) Math.pow(2, i);\n            res[i] = countFreqs(pow);\n        }\n        return res;\n    }\n    private byte[] countFreqs(int pow) {\n        byte[] freq = new byte[10];\n        while (pow > 0) {\n            int digit = pow % 10;\n            freq[digit]++;\n            pow /= 10;\n        }\n        return freq;\n    }\n    private boolean areSame(byte[] oc, byte[] freq) {\n        for (int i = 0; i < oc.length; i++) {\n            if (oc[i] != freq[i]) return false;\n        }\n        return true;\n    }\n}\n```\n
['C++', 'Java', 'Python3']