```
def plusOne(self, digits):
digits[:] = digits[::-1]
for i in range(len(digits)):
if digits[i] != 9:
digits[i] += 1
break
else:
digits[i] = 0
if i+1 >= len(digits):
digits.append(1)
return digits[::-1]
```