```
def plusOne(self, digits):
"""
:type digits: List[int]
:rtype: List[int]
"""
carry = 1
for i in reversed(xrange(len(digits))):
digits[i] += carry
if digits[i] > 9:
digits[i] = digits[i] % 10
carry = 1
else:
carry = 0
return [carry] + digits if carry else digits
```