```
class Solution(object):
def plusOne(self, digits):
"""
:type digits: List[int]
:rtype: List[int]
"""
if (digits[-1]+1)<10:
return digits[0:-1] + [digits[-1]+1]
else:
carry = 1
i = len(digits)-1
while(carry == 1):
temp = digits[i]
digits[i] = (temp+1)%10
carry = (temp+1)/10
if i == 0 and carry==1:
return [1] + digits
i = i-1
return digits
```