C++ | Easy solution with detailed explanation
Approach :\nEverything will be same as binary addition with base -2. Except when remainder is negative. \n\nsum = a1+a2+carry Possible values of sum are{ -1, 0,
# Approach :\nEverything will be same as binary addition with base -2. Except when remainder is negative. \n\n`sum = a1+a2+carry` Possible values of sum are` { -1, 0, 1, 2, 3} `\n`remainder = sum%(-2)` Possible values of remainder are` { -1, 0 , 1} `\n`carry = sum / (-2) `Possible values of carry are` { -1, 0, 1} `\nIn case of binary addition possible values of sum are` { 0, 1,2,3}` ,  remainders and carry are `{0 ,1} ` \n\nWe cannot have negative remainder so we should make it positive. \n\nAfter doing some iterations you will find that remainder is negative only when sum is negative. \n`N = divisor * quotient + remainder. `\nHere we are finding carry by dividing sum by (-2) so quotient is basically carry. \n```\nsum = (-2) *  carry + r \nwhen sum is -1. \n-1 = (-2) * 0 -1 \nTo make remainder positive add and subtract -2. \n-1 = -2* 0 -2 -1 +2;\n-1 = -2 * ( calculated_carry + 1 ) +1 \n```\nTo make remainder positive we have to increment carry by 1 and add 2 to remainder. \n\n```\nvector<int> addNegabinary(vector<int>& arr1, vector<int>& arr2) {\n        vector<int> ans;\n        int l= max(arr1.size(),arr2.size())+2;    // carry can be forwarded to maximum 2 positions. \n        int a1,a2,sum, carry=0,r;\n        reverse(arr1.begin(),arr1.end());\n        reverse(arr2.begin(),arr2.end());\n        int i=0; \n        \n        while(i<l){\n            a1 = i<arr1.size() ? arr1[i] : 0;\n            a2 = i<arr2.size() ? arr2[i] : 0; \n            sum = a1+a2+carry;\n            r= sum%(-2);\n            carry= sum/ (-2);\n            if(r<0){\n                r+=abs(-2);\n                carry =carry+1;\n            }\n            ans.push_back(r);\n            i++;\n        }\n        while(ans.back()==0&&ans.size()!=1)\n            ans.pop_back();     // remove trailing zeroes \n        reverse(ans.begin(),ans.end());\n        \n        return ans;\n    }\n```\n
['C', 'C++']