Another way in Python


  • 0
    F
    def plusOne(self, digits):
        """
        :type digits: List[int]
        :rtype: List[int]
        """
        s = map(str, digits)   
        s = ''.join(s)        
        s = int(s)            
        s += 1
        s = str(s)
        a = []
        length = len(s)
        for i in range(0, length):
            a.append(s[i])
        a = map(int, a)
        return a

Log in to reply
 

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