52 ms Python solution


  • 0
    G

    I would be happy to receive suggestion to improve my code:

    def plusOne(digits):
        count = len(digits)
        total = 0
        result = []
    
        for i in range(count):
            total += digits[i] * 10 ** (count-i-1)
        total += 1
        for s in str(total):
            result.append(int(s))
            
        return result

Log in to reply
 

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