Leetcode 43. Multiply Strings
class Solution(object): def multiply(self, num1, num2): """ :type num1: str :type num2: str :rtype: str """ n1 = len(num1) n2 = len(num2) num1 = num1[::-1] num2 = num2[::-1] prod = 0 for i in range(n1): for j in range(n2): cur = int(num1[i])*int(num2[j]) prod += cur*10**(i+j) return str(prod)