LeetCode-66-Plus One 水题

来源:互联网 发布:qq三国70js橙鬼 编辑:程序博客网 时间:2024/06/01 12:43


class Solution(object):    def plusOne(self, digits):        """        :type digits: List[int]        :rtype: List[int]        """        Len=len(digits)        jinwei=1        for i in range(Len-1,-1,-1):            digits[i]+=jinwei            jinwei=digits[i]/10            digits[i]%=10        if jinwei==1:            digits.insert(0,1)        return digits