python, from engineer thinking
simple and not optimized.\nwrite a func to convert from negabinary to dec and vice versa.\n\n\nclass Solution(object):\n    def negabinary_to_dec(self,arr):\n  
simple and not optimized.\nwrite a func to convert from negabinary to dec and vice versa.\n\n```\nclass Solution(object):\n    def negabinary_to_dec(self,arr):\n        s = 0\n        d = 1\n        i = len(arr)-1\n        while i>=0:\n            s += arr[i]*d\n            i -= 1\n            d *= -2\n        return s\n    \n    def dec_to_negabinary(self,n):\n        if n==0: return [0]\n        ret = []\n        while n != 0:\n            a = abs(n%(-2))\n            ret.append(a)\n            n = (n-a)//(-2)\n        return ret[::-1]\n    \n    def addNegabinary(self, arr1, arr2):\n        """\n        :type arr1: List[int]\n        :type arr2: List[int]\n        :rtype: List[int]\n        """\n        \n        a = self.negabinary_to_dec(arr1)\n        b = self.negabinary_to_dec(arr2)\n        return self.dec_to_negabinary(a+b)\n```
['Python']