A TLE method which not work at all
Since I don\'t think out how to do that wisely\nI just think in this way,\nbut surely if you consider the depth of recursive tree it would be\n2^30 which can no
Since I don\'t think out how to do that wisely\nI just think in this way,\nbut surely if you consider the depth of recursive tree it would be\n2^30 which can not be accepted at all\n```\nclass Solution {\n    public boolean found=false;\n    public String result="";\n    public String baseNeg2(int N) {\n        if(N==0){\n            return "0";\n        }\n        int[] buffer=new int[30];\n        int[] digit=new int[30];\n        int x=1;\n        for(int i=29;i>=0;i--){\n            buffer[i]=x;\n            x=x*(-2);\n        }\n        dfs(0,N,29,buffer,digit);\n        return result;\n    }\n    public void dfs(int cur,int N,int index,int[] buffer,int[] digit){\n        if(found||index<=0){\n            return;\n        }\n        if(cur==N){\n            found=true;\n            int i=0;\n            for(;i<=29;i++){\n                if(digit[i]==1){\n                    break;\n                }\n            }\n            StringBuilder builder=new StringBuilder();\n            while(i<=29){\n                builder.append(digit[i]+"");\n                i++;\n            }\n            result=builder.toString();\n            return;\n        }\n        cur+=buffer[index];\n        digit[index]=1;\n        dfs(cur,N,index-1,buffer,digit);\n        digit[index]=0;\n        cur-=buffer[index];\n        \n        dfs(cur,N,index-1,buffer,digit);\n    }\n  \n}\n```
[]