Simple python solution. 42ms.


  • 0
    H
    class Solution(object):
       def plusOne(self, digits):
          """
          :type digits: List[int]
          :rtype: List[int]
          """
        ans = []
        num=0
        for i in digits:
            num = num*10 + i
        num = num +1
        while(num!=0):
            ans.insert(0,num%10)
            num = num/10
        return ans

Log in to reply
 

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