✅C++ | ✅Easy to Understand
Code\n\nclass Solution \n{\npublic:\n    vector<int> addToArrayForm(vector<int>& num, int k) \n    {\n        int carry=0, sum, i=num.size()-1;\n        while(k
# Code\n```\nclass Solution \n{\npublic:\n    vector<int> addToArrayForm(vector<int>& num, int k) \n    {\n        int carry=0, sum, i=num.size()-1;\n        while(k || carry)\n        {\n            sum = carry + k%10;\n            k /= 10;\n\n            if(i>=0)\n            {\n                sum += num[i];\n                num[i] = sum%10;\n                i--;\n            }\n            else\n            {\n                num.insert(num.begin(), sum%10);\n            }\n            carry = sum/10;\n        }\n        return num;\n        \n    }\n};\n```
['Array', 'Math', 'C++']