题目:
题解:
class Solution:
def plusOne(self, digits: List[int]) -> List[int]:
n = len(digits)
for i in range(n - 1, -1, -1):
if digits[i] != 9:
digits[i] += 1
for j in range(i + 1, n):
digits[j] = 0
return digits
# digits 中所有的元素均为 9
return [1] + [0] * n