Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you have been placed in read-only mode.

Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript).

'''

class Solution(object): def plusOne(self, digits): n = len(digits) - 1 carry = 1 while carry: if n < 0: digits.insert(0,carry) break digits[n] += carry carry = digits[n] / 10 digits[n] %= 10 n -= 1

return digits

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.