✅Java | Easy Solution With Detailed Explanation
Approach\n Describe your approach to solving the problem. \n- We approach this question just like we add two numbers given that you can add only one-one digits 
# Approach\n<!-- Describe your approach to solving the problem. -->\n- We approach this question just like we add two numbers given that you can add only one-one digits at a time.\n- We start iterating to the array from the last of it, & also from the last of k as well.\n- At each iteration, we keep adding the `carry` , `num[i]` , & the last digit of `k` i.e. `k%10` to `digitSum`\n- We add the last digit of `digitSum` to the `list`\n- We keep the rest of the number to `carry`\n\n- After iterating we reverse the `list`. We could also do it without using the `reverse()` method by Using `list.add(0, digitSum%10)`. By doing this the `list` will be in the right order. But this takes more time because after adding the number to the index 0, the rest of the numbers needs to be shifted to the right.\n\n\n# Complexity\n- Time complexity: `O(n)`\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: `O(1)` Since we do not have used any extra space. The list that we created is the return type therefore no extra space is used.\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Please UPVOTE this if you find it useful\nLet\'s Connect On [LinkedIn OliFarhaan](https://www.linkedin.com/in/olifarhaan/)\n\n# Code\n```\nclass Solution {\n    public List<Integer> addToArrayForm(int[] num, int k) {\n        ArrayList<Integer> list= new ArrayList<>();\n        int carry=0, digitSum=0;\n        int i= num.length-1;\n        while(i>=0 || k >0 || carry >0){\n            digitSum=carry;\n            if(i>=0) digitSum += num[i--];\n            if(k>0) digitSum += k%10;\n            list.add(digitSum%10);\n            k=k/10;\n            carry= digitSum/10;\n        }\n        Collections.reverse(list);\n        return list;\n    }\n}\n```
['Array', 'Math', 'Java']