Using divmod() results in 90% speed
\nclass Solution:\n    def baseNeg2(self, n: int) -> str:\n        if n > 0:\n            res = []\n            while n:\n                n, r = divmod(n, -2)\n
```\nclass Solution:\n    def baseNeg2(self, n: int) -> str:\n        if n > 0:\n            res = []\n            while n:\n                n, r = divmod(n, -2)\n                if r == -1:\n                    # because -1 = (-2)^1 + (-2)^0\n                    n += 1\n                    r = 1\n                res.append(str(r))\n            return "".join(res[::-1])\n        return "0"\n```
['Python3']