[Java] 3 lines solution
First, find the upper bound of N in baseNeg2 with the same number of bits by using the pattern "01".\nSecond, reduce the upper bound to N by using XOR.\n\n\n   
First, find the upper bound of N in baseNeg2 with the same number of bits by using the pattern "01".\nSecond, reduce the upper bound to N by using XOR.\n\n```\n    public String baseNeg2(int N) {\n        int num = 1;\n        while (num < N) num = (num << 2) + 1;\n        return Integer.toBinaryString(num ^ (num - N));\n    }\n```
[]