Simple python solution with explanation

  • 0

    My idea is to use the type conversion.

    class Solution(object):
        def plusOne(self, digits):
            :type digits: List[int]
            :rtype: List[int]
            s = ''
            for i in digits:
                s += str(i)
            s = str(int(s) + 1)
            return [int(i) for i in s]

Log in to reply

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