Java Use stack Beat 100%
\nclass Solution {\n    public int[] addNegabinary(int[] arr1, int[] arr2) {\n        int i = arr1.length - 1, j = arr2.length - 1, carry = 0;\n        Stack<In
```\nclass Solution {\n    public int[] addNegabinary(int[] arr1, int[] arr2) {\n        int i = arr1.length - 1, j = arr2.length - 1, carry = 0;\n        Stack<Integer> stack = new Stack<>();\n        while (i >= 0 || j >= 0 || carry != 0) {\n            int v1 = i >= 0 ? arr1[i--] : 0;\n            int v2 = j >= 0 ? arr2[j--] : 0;\n            carry = v1 + v2 + carry;\n            stack.push(carry & 1);\n            carry = -(carry >> 1);\n        }\n        while (!stack.isEmpty() && stack.peek() == 0) stack.pop();\n        int[] res = new int[stack.size()];\n        int index = 0;\n        while (!stack.isEmpty()) {\n            res[index++] = stack.pop();\n        }\n        return res.length == 0 ? new int[1] : res;\n    }\n}\n```
[]