```
def plusOne(self, digits):
"""
:type digits: List[int]
:rtype: List[int]
"""
carry = (digits[-1] + 1) // 10
digits[-1] = (digits[-1] + 1) % 10
if not carry:
return digits
i = len(digits) - 2
while i >= 0 and carry:
n = digits[i]
digits[i] = (n + carry) % 10
carry = (n + carry) // 10
i -= 1
return [carry] + digits if carry else digits
```