C++ log(n) Solution | 100%
\nclass Solution {\npublic:\n    string baseNeg2(int N) {\n        if(N == 0) return "0";\n        string ans = "";\n        while(N){\n            ans = to_str
```\nclass Solution {\npublic:\n    string baseNeg2(int N) {\n        if(N == 0) return "0";\n        string ans = "";\n        while(N){\n            ans = to_string(abs(N % 2)) + ans;\n            if(abs(N) % 2){\n                if(N < 0) N = N / -2 + 1;\n                else N = N / -2;\n            } else {\n                N = N / -2;\n            }\n        }\n        return ans;\n    }\n};\n```
['Math', 'C']