Convert to Base -2
Complexity
Time complexity: O(N)

Space complexity: O(1)
Code


# Complexity
- Time complexity: O(N)
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity: O(1)
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```python []
class Solution(object):
    def baseNeg2(self, n):
        """
        :type n: int
        :rtype: str
        """
        if n == 0:
            return "0"
        
        res = []
        while n != 0:
            rem = n % -2
            n //= -2

            if rem < 0:
                rem += 2
                n += 1
            
            res.append(str(rem))
        
        return "".join(res[::-1])
```
['Math', 'Python']