Given two numbers represented as strings, return multiplication of the numbers as a string.
Note: The numbers can be arbitrarily large and are non-negative.
Solution:
Python can handle infinitely precision for integers, hence we can just convert the numbers to integers multiply them and convert to string
class Solution:
# @param num1, a string
# @param num2, a string
# @return a string
def multiply(self, num1, num2):
return str(int(num1)*int(num2))
No comments :
Post a Comment