C++ 4ms solution
\n# Code\n\nclass Solution {\npublic:\n    vector<int> addNegabinary(vector<int>& arr1, vector<int>& arr2) {        \n        std::reverse(arr1.begin(), arr1.en
\n# Code\n```\nclass Solution {\npublic:\n    vector<int> addNegabinary(vector<int>& arr1, vector<int>& arr2) {        \n        std::reverse(arr1.begin(), arr1.end());\n        std::reverse(arr2.begin(), arr2.end());\n        const int dataSize = std::max(arr1.size(), arr2.size());\n        const int ansSize = dataSize + 2;\n        vector<int> ans(ansSize, 0);\n        for (int i = 0; i < ansSize; i ++) {\n            const int a1 = (arr1.size() > i) ? arr1[i] : 0;\n            const int a2 = (arr2.size() > i) ? arr2[i] : 0;\n            const int sum = a1 + a2 + ans[i];\n            ans[i] = (sum % 2 == 0) ? 0 : 1;\n            if (sum < 0) {\n                ans[i + 1] ++;\n            } else if (sum > 1) {\n                ans[i + 1] --;\n            }\n        }\n\n        while (ans.size() > 1 && ans.back() == 0) {\n            ans.pop_back();\n        }\n\n        std::reverse(ans.begin(), ans.end());\n        return ans;\n    }\n};\n\n// 16 -8 4 -2 1 = 21 - 10 = 11\n// 5\n// 16\n\n// 16, -8, 4, -2, 1\n// 1.  1.  1.  1. 1\n// 0.  0.  1.  0. 1\n// 1   0   0   0  0\n\n// 1.  1.  1.  0. 1  ==> 13\n// 0.  0.  1.  0. 1  ==>  5   = 18 \n\n// 1.  0.  1.  1. 0  ==> 18 \n\n\n/*\n\n-10 (1010)\n-9 (1011)\n-8 (1000)\n-7 (1001)\n-6 (1110)\n-5 (1111)\n-4 (1100)\n-3 (1101)\n-2 (010)\n-1 (011)\n0 (000)\n1 (001)\n2 (110)\n3 (111)\n4 (100)\n5 (101)\n\n*/\n```
['C++']