Solution in linear Complexity using Basic Maths
Complexity\n- Time complexity:O(n)\n Add your time complexity here, e.g. O(n) \n\n- Space complexity:O(1)\n Add your space complexity here, e.g. O(n) \n\n# Code
# Complexity\n- Time complexity:$$O(n)$$\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:$$O(1)$$\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\n    public String baseNeg2(int n) {\n        //Base Case\n        if(n==0) return "0";\n\n        StringBuilder sb = new StringBuilder();\n        while(n != 0){\n            int rem = n%-2;\n            n /= -2;\n\n            if(rem < 0){\n                rem -= -2;\n                n++;\n            }\n\n            sb.append(rem);\n        }\n\n        return sb.reverse().toString();\n    }\n}\n```
['Math', 'Java']