[C++] - Beats 100%, While Loop
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    vector<int> addNegabinary(vector<int>& arr1, vector<int>& arr2) {\n        int arr1_length = arr1.size(), arr2_length = arr2.size();\n        int maximum_length = max(arr1_length, arr2_length) + 2;\n        int minimum_length = max(arr1_length, arr2_length);\n        vector<int> result(maximum_length);\n\n        reverse(arr1.begin(), arr1.end());\n        reverse(arr2.begin(), arr2.end());\n\n        for (int i{}; i < arr1.size(); ++i)\n            result.at(i) += arr1.at(i);\n\n        for (int i{}; i < arr2.size(); ++i)\n            result.at(i) += arr2.at(i);\n\n        int carry = 0;\n        int i = 0;\n        while (i < maximum_length)\n        {\n            auto& number = result.at(i);\n            if (number == 0 && carry == -1)\n            {\n                result.at(i) += 1;\n                result.at(i + 1) += 1;\n                carry = 0;\n            }\n            else if (number == 3)\n            {\n                result.at(i) = 1;\n                carry = -1;\n            }\n            else if (number == 1 && carry == -1)\n            {\n                number = 0;\n                carry = 0;\n            }\n            else if (number == 2 && carry == -1)\n            {\n                number = 1;\n                carry = 0;\n            }\n            else if (number == 2)\n            {\n                number = 0;\n                carry = -1;\n            }\n            i++;\n        }\n\n        while (result.size() > minimum_length && result.back() == 0)\n            result.pop_back();\n\n        if (all_of(result.begin(), result.end(), [](auto number) { return number == 0; }))\n            return { 0 };\n\n        reverse(result.begin(), result.end());\n\n        auto one = find(result.begin(), result.end(), 1);\n        if (one != result.begin())\n        {\n            result = {one, result.end()};\n        }\n\n        return result;\n    }\n};\n```
['C++']