n = len(digits)
for i in range(n):
digits[n-1-i] = (digits[n-1-i] + 1) % 10
if digits[n-1-i] != 0:
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.