Just for fun: the one-liner Python solution (not really)

  • 0

    This is a one-liner solution in Python. :-)

    def multiply(self, num1, num2):
        return str(int(num1)*int(num2))

    Of course, this is NOT considered as a real solution, although it can pass the OJ check among the fastest possible (50ms) solution in Python category.

    My real python solution ends up ~180ms.

  • 0

    :) this is what I exactly tried and it passes the OJ . I guess I should give this a more honest try

    class Solution:
        # @param num1, a string
        # @param num2, a string
        # @return a string
        def multiply(self, num1, num2):
            return str(int(num1) * int(num2))

Log in to reply

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