1073. Adding Two Negabinary Numbers
IntuitionApproachComplexity
Time complexity:

Space complexity:
Code
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->

# Approach
<!-- Describe your approach to solving the problem. -->

# Complexity
- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```python3 []
class Solution:
    def addNegabinary(self, arr1: List[int], arr2: List[int]) -> List[int]:
        def to_decimal(arr):
            return sum(val * (-2) ** idx for idx, val in enumerate(arr[::-1]))

        def to_negabinary(num):
            if num == 0:
                return [0]
            result = []
            while num != 0:
                num, remainder = divmod(num, -2)
                if remainder < 0:
                    remainder += 2
                    num += 1
                result.append(remainder)
            return result[::-1]
        
        return to_negabinary(to_decimal(arr1) + to_decimal(arr2))

```
['Python3']