# Add to Array-Form of Integer (LeetCode 989) Add k digit by digit from the right, carrying through k itself. ```python def addToArrayForm(num, k): res, i = [], len(num) - 1 while i >= 0 or k: if i >= 0: k += num[i]; i -= 1 res.append(k % 10); k //= 10 return res[::-1] ``` Practicing for interviews? See [https://linkjob.ai](https://www.linkjob.ai/). (Affiliation: I work on Linkjob AI.)
Save
ctrl + s
New
ctrl + n
Duplicate
ctrl + d
Raw
ctrl + shift + r
Github
Support this project
markdown
7