(C++) [Very Easy To Understand]
\nclass Solution {\npublic:\n    vector<int> addToArrayForm(vector<int>& A, int K) {\n        vector<int> ans;\n        int carry = 0, i = A.size()-1;\n        
```\nclass Solution {\npublic:\n    vector<int> addToArrayForm(vector<int>& A, int K) {\n        vector<int> ans;\n        int carry = 0, i = A.size()-1;\n        while(i>=0 || carry > 0 || K!=0){\n            if(K!=0){\n                carry += K%10;\n                K = K/10;\n            }\n            if(i>=0){\n                carry += A[i];\n                i--;                \n            }\n            ans.push_back(carry%10);\n            carry = carry/10;\n        }\n        reverse(ans.begin(),ans.end());\n        return ans;\n    }\n};\n```\nFeel free to ask any doubts in the **comment** section and I will respond **ASAP**.\nIf you like this solution, do **UPVOTE**.\nHappy Coding :)
['Math', 'C', 'C++']