Simple python solution


  • 0
    D
    class Solution(object):
        def multiply(self, num1, num2):
            len1 = len(num1) - 1
            len2 = len(num2) - 1
            total_1 = 0
            total_2 = 0
            for index, char in enumerate(num1):
                total_1 += (ord(char) - 48) * (10**(len1 - index))
            for index, char in enumerate(num2):
                total_2 += (ord(char) - 48) * (10**(len2 - index))  
            return str(total_1*total_2)
    

Log in to reply
 

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