Dashboard Temp Share Shortlinks Frames API

HTMLify

Day 83
Views: 2 | Author: djdj
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
class Solution(object):
    def addToArrayForm(self, num, k):
        """
        :type num: List[int]
        :type k: int
        :rtype: List[int]
        """
        n = 0
        for digit in num:
            n = n * 10 + digit
        total = n + k
        result = []
        for digit in str(total):
            result.append(int(digit))
        return result