5 lines of python solution


  • 0
    I
        def addStrings(self, num1, num2):
            return "%d" % (self.convert_int(num1) + self.convert_int(num2))
        
        def convert_int(self, string):    
            num = reduce(lambda x,y: x*10+ord(y)-ord('0'), list(string),0)
            return num
    

Log in to reply
 

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