easy understand solution


  • 0

    '''

    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
    

    '''


Log in to reply
 

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