You are given two numbers represented in negabinary (base arr = [1,1,0,1] corresponds to the value
Each input array is guaranteed to contain no leading zeros: either the array is [0], or the first element is
Given two such arrays arr1 and arr2, compute their sum and return the result in the same negabinary array format, with no leading zeros.
Constraints:
arr1.length, arr2.length
arr1[i] and arr2[i] are
arr1 and arr2 have no leading zeros
The key insight is that adding two negabinary numbers works similarly to adding two regular binary numbers, except the base is
You are given two numbers represented in negabinary (base arr = [1,1,0,1] corresponds to the value
Each input array is guaranteed to contain no leading zeros: either the array is [0], or the first element is
Given two such arrays arr1 and arr2, compute their sum and return the result in the same negabinary array format, with no leading zeros.
Constraints:
arr1.length, arr2.length
arr1[i] and arr2[i] are
arr1 and arr2 have no leading zeros
The key insight is that adding two negabinary numbers works similarly to adding two regular binary numbers, except the base is