from typing import List


class Solution:
    def plusOne(self, digits: List[int]) -> List[int]:

        for i in range(len(digits) - 1, -1, -1):
            if digits[i] == 9:
                digits[i] = 0
            else:
                digits[i] = digits[i] + 1
                return digits
        return [1] + digits


sl1 = Solution()
print(sl1.plusOne([1, 3, 5, 6]))
print("---")
print(sl1.plusOne([1, 2, 3]))
print("---")
print(sl1.plusOne([4, 3, 2, 1]))
print("---")
print(sl1.plusOne([9, 9, 9]))
print("---")
print(sl1.plusOne([0]))
print("---")
print(sl1.plusOne([9]))
print("---")
print(sl1.plusOne([1, 9, 9, 9, 9]))
print("---")
print(sl1.plusOne([9, 8, 9]))
