LeetCode--加一(python版)

class Solution(object):
    def plusOne(self, digits):
        """
        :type digits: List[int]
        :rtype: List[int]
        """
        return_list=[]
        sum=0
        for i in range(len(digits)):
            sum=sum+digits[i]*10**(len(digits)-i-1)
        sum=sum+1
        sum=str(sum)
        for i in sum:
            return_list.append(int(i))
        return return_list

你可能感兴趣的:(LeetCode--加一(python版))