Java | O(n) Time | O(n) Space
\nclass Solution {\n    // O(n) Time | O(n) Space\n    public List<Integer> addToArrayForm(int[] num, int k) {\n        int n = num.length;\n        ArrayList<I
```\nclass Solution {\n    // O(n) Time | O(n) Space\n    public List<Integer> addToArrayForm(int[] num, int k) {\n        int n = num.length;\n        ArrayList<Integer> list = new ArrayList<>();\n        for(int i = n - 1; i >= 0; i--) { \n            int sum = num[i] + k;\n            list.add(sum % 10); // Inserting at the end of arraylist takes O(1) time.\n            k = sum / 10;\n        }\n        while(k > 0) {\n            list.add(k % 10); \n            k = k / 10;\n        }\n        Collections.reverse(list); // Reversing will take O(n) time.\n        return list;\n    }\n}\n```
['Java']