✅ [Java/C++] 100% Solution using Math (Add to Array-Form of Integer)
Complexity\n- Time complexity: O(max(n,m)) \n Add your time complexity here, e.g. O(n) \n\n- Space complexity: O(max(n,m))\n Add your space complexity here, e.g
# Complexity\n- Time complexity: $$O(max(n,m))$$ \n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: $$O(max(n,m))$$\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n*where n is size of num vector and m is number of digits in k.*\n\n# Code\n```C++ []\nclass Solution {\npublic:\n    vector<int> addToArrayForm(vector<int>& num, int k) {\n        vector<int> ans;\n        int i=num.size();\n        while(i || k!=0)\n        {\n            if(i>0)\n                k+=num[--i];\n\n            ans.push_back(k%10);\n            k/=10;\n        }\n        reverse(ans.begin(),ans.end());\n        return ans;\n    }\n};\n```\n```Java []\nclass Solution {\n    public List<Integer> addToArrayForm(int[] num, int k) {\n        ArrayList<Integer> ans = new ArrayList<>();\n        int i=num.length;\n        while(i>0 || k!=0)\n        {\n            if(i>0)\n                k+=num[--i];\n\n            ans.add(k%10);\n            k/=10;\n        }\n        Collections.reverse(ans);\n        return ans;\n    }\n}\n```
['Math', 'C++', 'Java']