Solution
C++ []\nclass Solution {\npublic:\n    string baseNeg2(int n) {\n        if (n == 0)\n            return "0";\n        string out = "";\n        while (n) {\n  
```C++ []\nclass Solution {\npublic:\n    string baseNeg2(int n) {\n        if (n == 0)\n            return "0";\n        string out = "";\n        while (n) {\n            out = ((n&1) ? "1" : "0") + out;\n            n = -(n >> 1);\n        }\n        return out;\n    }\n};\n```\n\n```Python3 []\nclass Solution:\n    def baseNeg2(self, n: int) -> str:\n        if n==0:\n            return \'0\'\n\n        ret = []\n        while (n != 0):\n\n            if n % 2 == 0:\n                ret.append(\'0\')\n                n //= -2\n            else:\n                ret.append(\'1\')\n                n = (n - 1) // -2\n\n        return \'\'.join(ret[::-1])\n```\n\n```Java []\nclass Solution {\n    public String baseNeg2(int n) {\n        StringBuilder sc = new StringBuilder();\n        int rem;\n        int b = -2;\n        if(n == 0)\n            sc.append(\'0\');\n        while(n != 0){\n            rem = n % b;\n            n /= b;\n            if(rem < 0){\n                rem -= b;\n                n++;\n            }\n            sc.append(rem);\n        }\n        return sc.reverse().toString();\n    }\n}\n```
['C++', 'Java', 'Python3']