✔️Python, C++,Java|| Beginner level ||As Simple As U Think||Simple-Short-Solution✔️
Please upvote to motivate me in my quest of documenting all leetcode solutions. HAPPY CODING:)\nAny suggestions and improvements are always welcome.\n___\n__\nQ
***Please upvote to motivate me in my quest of documenting all leetcode solutions. HAPPY CODING:)\nAny suggestions and improvements are always welcome*.**\n___________________\n_________________\n***Q989. Add to Array-Form of Integer***\nThe **array-form** of an integer num is an array representing its digits in left to right order.\n\n* `For example, for num = 1321, the array form is [1,3,2,1].`\n\nGiven num, the **array-form** of an integer, and an integer k`, return the `**array-form** of the integer `num + k`\n____________________________________________________________________________________________________________________\n____________________________________________________________________________________________________________________\n\u2705 **Python  Code** :\n```\nclass Solution:\n    def addToArrayForm(self, num: List[int], k: int) -> List[int]:\n        s=\'\'.join(map(str,num))\n        a=int(s)+k\n        return [int(i) for i in str(a)]\n```\n**Runtime:**  662 ms\t\n**Memory Usage:**  13.9 MB\n____________________________________________________________________________________________________________________\n____________________________________________________________________________________________________________________\n\n\u2705 **Java Code** :\n```\nclass Solution {\n    public List<Integer> addToArrayForm(int[] num ,int k) {\n        List<Integer> res = new LinkedList<>();\n        for (int i = num.length - 1; i >= 0; --i) \n        {\n            res.add(0, (num[i] + k) % 10);\n            k = (num[i] + k) / 10;\n        }\n        while (k > 0) {\n            res.add(0, k % 10);\n            k /= 10;\n        }\n        return res;\n    }\n}\n```\n**Runtime:**  11 ms\t\t\n**Memory Usage:**  62.8 MB\t\n____________________________________________________________________________________________________________________\n____________________________________________________________________________________________________________________\n\u2705 **C++  Code** :\n\n```\nclass Solution {\npublic:\n    vector<int> addToArrayForm(vector<int>& num, int k) {\n        int l=num.size()-1;\n        for(int i=l;i>=0&&k>0;--i)\n        {\n            num[i]=num[i]+k;\n            k=num[i]/10;\n            num[i]=num[i]%10;\n        }\n        while(k>0)\n        {\n            num.insert(num.begin(),k%10);\n            k/=10;\n        }\n        return num;\n    }\n};\n```\n**Runtime:** 11 ms\t\n**Memory Usage:**  62.3 MB\t\t\n____________________________________________________________________________________________________________________\n____________________________________________________________________________________________________________________\nIf you like the solution, please upvote \uD83D\uDD3C\nFor any questions, or discussions, comment below. \uD83D\uDC47\uFE0F\n
['C', 'Python', 'Java']