Python solution


  • 1
    G
    class Solution:
        # @param digits, a list of integer digits
        # @return a list of integer digits
        def plusOne(self, digits):
            num = 0
            for d in digits:
                num *= 10
                num += d
            
            num += 1
            output = []
    
            while num:
                temp = num % 10
                num /= 10
                output.append(temp)
            
            return output[::-1]

Log in to reply
 

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