C++ Solution Works with Base in between -2 and -10
\nclass Solution {\npublic:\n    string baseNeg2(int N) {\n        string res = "";\n        int base = -2;\n        while (N) {\n            int remainder = N 
```\nclass Solution {\npublic:\n    string baseNeg2(int N) {\n        string res = "";\n        int base = -2;\n        while (N) {\n            int remainder = N % base;\n            N = N / base;\n            if (remainder < 0) {\n\t\t\t// in most compilers, the result of dividing a negative number by a negative number is rounded towards 0\n\t\t\t// eg: -4 % -3 = -1\n\t\t\t// if remainder is negative, add abs(base) to it and add 1 to n\n                remainder += -base;\n                N++;\n            }\n            res = to_string(remainder)+res;\n        }\n        return res == "" ? "0" : res;\n    }\n\n};\n```
[]