Python3 Solution [Accepted]


  • 0
    S
    class Solution:
        def plusOne(self, digits):
            dig_str = ""
            dig_int = 0
            s = []
            for i in range(0, len(digits)):
                dig_str += str(digits[i])
                dig_int = str(int(dig_str) + 1)
            for j in range(0, len(dig_int)):
                s.append(int(dig_int[j]))
    
            return s
    
    
    a = [5, 2, 3]
    ans = Solution().plusOne
    print(ans(a))
    

Log in to reply
 

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