Functional Python in one line(if you like)


  • 0
    M
    class Solution(object):
        def plusOne(self, digits):
            num = ''.join((list(map(str, digits))))        
            return list(map(int, list(str(int(num) + 1))))
    

    You can combine two expressions in one,but that would be too long to catch.


Log in to reply
 

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