Easy approach used in multiple problems
Intuition\nSimilar problems are:\n-> Add Two Numbers\n-> Plus One\n-> Add Binary\n-> Add Strings\n\n# Approach\nfirst convert given k into vector.\nNow place tw
# Intuition\nSimilar problems are:\n-> Add Two Numbers\n-> Plus One\n-> Add Binary\n-> Add Strings\n\n# Approach\nfirst convert given k into vector.\nNow place two pointer.\nOne at the last of first vector.\nSecond pointer at the last of second vector.\nThere is also a variable carry which is used for carry as well as sum of two number at i and j index.\n\n\n# Complexity\n- Time complexity:\n$$O(max(len(num1),len(num2)))$$\n\n- Space complexity:\n$$O(max(len(num1),len(num2)))$$\n\n# Code\n```\nclass Solution {\npublic:\n    vector<int> addToArrayForm(vector<int>& num1, int k) {\n        vector<int>num2;\n//      Converting k into vector\n        while(k){ \n            num2.push_back(k%10);\n            k=k/10;\n        }\n        reverse(num2.begin(),num2.end());\n//      Reverse the vector\n        vector<int>vect;\n//      First pointer at the end of num1\n        int i=num1.size()-1;\n//      Second pointer at the end of num2\n        int j=num2.size()-1;\n        int carry=0;\n        while(i>=0 || j>=0 || carry){\n//          condition is running untill array has element.\n            if(i>=0){\n                carry+=num1[i];\n                i--;\n            }\n//          condition is running untill array has element.\n            if(j>=0){\n                carry+=num2[j];\n                j--;\n            }\n            vect.push_back(carry%10);\n            carry=carry/10;\n        }\n//         reverse the \n        reverse(vect.begin(),vect.end());\n        return vect;\n    }\n};\n```
['C++']