Python code super simple

  • -4

    The python code is super simple but I think I defeated the purpose.

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

  • 1

    Hmmm. That's why people would like to use Python to do ProjectEuler...

  • 0

    accepted using int
    return str(int(num1) * int(num2))

  • -1

    Here is a simple Java version. Take advantage of the BigInteger class.

    public String multiply(String num1, String num2) {
        java.math.BigInteger b1 = new java.math.BigInteger(num1);
        java.math.BigInteger b2 = new java.math.BigInteger(num2);
        return b1.multiply(b2).toString();

  • 3

    Use the utility in the API is recommended in the project. But if you use it in an interview, you will definitely fail .

  • 0

    In a big company, ability to solve tasks by using APIs is necessary.

  • 0

    this is meaningless

  • 0

    Good luck with that on an interview :D

Log in to reply

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