✅ Java | Easy | Two Approaches | Math | 100% faster
Approach 1\n\nclass Solution {\n    public List<Integer> addToArrayForm(int[] num, int k) {\n        LinkedList<Integer> res=new LinkedList<>();\n        int ca
**Approach 1**\n```\nclass Solution {\n    public List<Integer> addToArrayForm(int[] num, int k) {\n        LinkedList<Integer> res=new LinkedList<>();\n        int carry=0;\n        int i=0;\n\t\t/*We always start computing from array\'s last element and k\'s last digit and will \n\t\tcompute sum and carry. We will iterate it till k and index of array both have existance. \n\t\tIf one of them gets exhausted the for loop below will not work.*/\n        for(i=num.length-1;i>=0 && k>0;i--){\n            int temp=num[i];\n            res.addFirst((temp+carry+(k%10))%10);\n            carry=(temp+carry+(k%10))/10;\n            k/=10;\n        }\n\t\t/*If for an instance your k is greater than the number that is present in the form of \n\t\tarray then the below while loop will work.*/\n        while(k!=0){\n            int compute=(k%10)+carry;\n            res.addFirst(compute%10);\n            carry=compute/10;\n            k/=10;\n        }\n\t\t/*If for an instance the number that is present in the form of array is greater than k \n\t\tthen the below for loop will work.*/\n        for(int r=i;r>=0;r--){\n            int temp=num[r];\n            res.addFirst((temp+carry)%10);\n            carry=(temp+carry)/10;\n        }\n\t\t/*If there is some carry still remaining at last then add it to beginning of the \n\t\tarraylist or linkedlist.*/\n        if(carry!=0)\n            res.addFirst(carry);\n        return res;\n    }\n}\n```\n\n**Approach 2 (incase someone doesn\'t want to use LinkedList that is used in Approach 1 and want to use ArrayList only)**\n```\nclass Solution {\n    public List<Integer> addToArrayForm(int[] num, int k) {\n        ArrayList<Integer> res=new ArrayList<>();\n        int carry=0;\n        int i=0;\n        for(i=num.length-1;i>=0 && k>0;i--){\n            int temp=num[i];\n            res.add(0,(temp+carry+(k%10))%10);\n            carry=(temp+carry+(k%10))/10;\n            k/=10;\n        }\n        while(k!=0){\n            int compute=(k%10)+carry;\n            res.add(0,compute%10);\n            carry=compute/10;\n            k/=10;\n        }\n        for(int r=i;r>=0;r--){\n            int temp=num[r];\n            res.add(0,(temp+carry)%10);\n            carry=(temp+carry)/10;\n        }\n        if(carry!=0)\n            res.add(0,carry);\n        return res;\n    }\n}\n```\n\n**Approach 3**\n```\nclass Solution {\n    public List<Integer> addToArrayForm(int[] num, int k) {\n        LinkedList<Integer> res=new LinkedList<>();\n        int len=num.length-1;\n        while(len>=0 || k>0){\n            if(len>=0){\n                k+=num[len--];\n            }\n            res.addFirst(k%10);\n            k/=10;\n        }\n        return res;\n    }\n}\n```\n![image](https://assets.leetcode.com/users/images/7d843226-f217-4fe9-a80a-e940a877394b_1676433898.1173701.jpeg)\n\n
['Array', 'Linked List', 'Math', 'Java']