66. Plus One

66. Plus One

题目:
https://leetcode.com/problems/plus-one/

难度 : Easy

奇怪的AC了

搞笑


class Solution(object):
    def plusOne(self, digits):
        """
        :type digits: List[int]
        :rtype: List[int]
        """
        if digits == []:
            return [1]
        if digits[-1] < 9:
            return digits[:-1] + [digits[-1] + 1]
        else:
            return self.plusOne(digits[:-1]) + [0]

你可能感兴趣的:(66. Plus One)