1073. Adding Two Negabinary Numbers.cpp
Code\n\nclass Solution {\npublic:\n    vector<int> addNegabinary(vector<int>& arr1, vector<int>& arr2) {        \n        int i = arr1.size()-1;\n        int j 
**Code**\n```\nclass Solution {\npublic:\n    vector<int> addNegabinary(vector<int>& arr1, vector<int>& arr2) {        \n        int i = arr1.size()-1;\n        int j = arr2.size()-1;\n        vector<int>bits = {0,1,0,1,0,1};\n        vector<int>carries = {1,1,0,0,-1,-1};        \n        vector<int>res;        \n        int sum;\n        int carry = 0;\n        while(i>=0 || j>=0 || carry)\n        {\n            sum = carry + (i>=0 ? arr1[i--] : 0) + (j>=0 ? arr2[j--] : 0);         \n            carry = carries[sum+2];\n            res.push_back(bits[sum+2]);\n        }\n        while(res.size() > 1 && res.back()==0)res.pop_back();        \n        reverse(res.begin(),res.end());        \n        return res;\n    }\n};\n```
['C']