Java O(N)
\n /*\n  Idea:\n  "Given two numbers arr1 and arr2 in base -2."\n  So:\n    - for any column it s possible to have -1,0,1.\n    - For 2 neighbor columns:\n     
```\n /*\n  Idea:\n  "Given two numbers arr1 and arr2 in base -2."\n  So:\n    - for any column it s possible to have -1,0,1.\n    - For 2 neighbor columns:\n      left:-2^i | right:2^{i-1}:\n      -------------------------\n           x        y\n           1        1\n           0        0\n          -1       -1\n      -------------------------\n           x= y*(-2)\n\n   */\n  // O(N)\n  public int[] addNegabinary(int[] arr1, int[] arr2) {\n    int M = arr1.length, N = arr2.length;\n    int i = M - 1, j = N - 1;\n    Stack<Integer> res = new Stack();\n    int carry = 0;\n    while (i >= 0 || j >= 0 || carry != 0) {\n      if (i >= 0) carry += arr1[i--];\n      if (j >= 0) carry += arr2[j--];\n\n      res.push(carry & 1);\n      carry = (-1) * (carry >> 1);\n    }\n\n    while (res.size() > 1 && res.peek() == 0) res.pop();\n    int[] r = new int[res.size()];\n    i = 0;\n    while (!res.isEmpty()) {\n      r[i++] = res.pop();\n    }\n    return r;\n  }\n```
[]