```
class Solution(object):
def plusOne(self, digits):
"""
:type digits: List[int]
:rtype: List[int]
"""
carry = 1
for i in range(len(digits))[::-1]:
carry,digits[i] = divmod(digits[i]+carry,10)
if carry == 0:
break
if carry ==1 and i == 0:
digits.insert(0,1)
return digits
```