Python3 Solution


  • 0
    E

    '''

    This solution is correct but it won't pass the tests as the tests aren't accurate beyond 17 digits

    class Solution:
    def multiply(self, num1, num2):
    """
    :type num1: str
    :type num2: str
    :rtype: str
    """
    num1 = [int(x) for x in list(num1)]
    num2 = [int(y) for y in list(num2)]

        numToMult1 = 0
        for i in num1:
            numToMult1 += i
            numToMult1 = numToMult1 * 10
        numToMult1 = numToMult1 / 10
        
        numToMult2 = 0
        for i in num2:
            numToMult2 += i
            numToMult2 = numToMult2 * 10
        numToMult2 = numToMult2 / 10
        
        answer = numToMult1 * numToMult2
        return str(int(answer))
    

    '''


Log in to reply
 

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