JAVA Naive Backtracking 15 lines
\nclass Solution {\n    public boolean reorderedPowerOf2(int N) {\n        char[] ca=(N+"").toCharArray();\n        return helper(ca, 0, new boolean[ca.length])
```\nclass Solution {\n    public boolean reorderedPowerOf2(int N) {\n        char[] ca=(N+"").toCharArray();\n        return helper(ca, 0, new boolean[ca.length]);\n    }\n    public boolean helper(char[] ca, int cur, boolean[] used){\n        if (cur!=0 && (cur+"").length()==ca.length){\n            if (Integer.bitCount(cur)==1) return true;\n            return false;\n        }\n        for (int i=0; i<ca.length; i++){\n            if (used[i]) continue;\n            used[i]=true;\n            if (helper(ca, cur*10+ca[i]-\'0\', used)) return true;\n            used[i]=false;\n        }\n        return false;\n    }\n}\n```\nIt would be faster if you use memo to prune.\n```\nclass Solution {\n    public boolean reorderedPowerOf2(int N) {\n        char[] ca=(N+"").toCharArray();\n        return helper(ca, 0, new boolean[ca.length], new HashSet<Integer>());\n    }\n    public boolean helper(char[] ca, int cur, boolean[] used, HashSet<Integer> vis){\n        if (!vis.add(cur)) return false;\n        if (cur!=0 && (cur+"").length()==ca.length){\n            if (Integer.bitCount(cur)==1) return true;\n            return false;\n        }\n        for (int i=0; i<ca.length; i++){\n            if (used[i]) continue;\n            used[i]=true;\n            if (helper(ca, cur*10+ca[i]-\'0\', used, vis)) return true;\n            used[i]=false;\n        }\n        return false;\n    }\n}\n```
[]