A simple python solution

  • -1
    class Solution(object):
        def multiply(self, num1, num2):
            :type num1: str
            :type num2: str
            :rtype: str
            res = 0
            for i in num1:
                tmp = 0
                for j in num2:
                    tmp = tmp*10 + int(i)*int(j)
                res = res*10 + tmp
            return str(res)

Log in to reply

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