Multiply Strings

Given two non-negative integers num1 and num2 represented as strings, return the product of num1 and num2, also represented as a string.

You must not use any built-in big integer library or convert the inputs directly to integers.

Example 1
Inputnum1 = "2", num2 = "3"
Output"6"
The product of 2 and 3 is 6.
Example 2
Inputnum1 = "123", num2 = "456"
Output"56088"
The product of 123 and 456 is 56088.

Constraints

  • 1 <= num1.length, num2.length <= 200
  • num1 and num2 consist of digits only.
  • Both num1 and num2 do not contain any leading zero, except the number 0 itself.

Asked at 17 companies

</>

Your Solution

(Ctrl/Cmd + Enter)

Switching Language

Loading template...

Loading...

Sign in to save your progress

AI code evaluation

Get a correctness verdict, missed edge cases, and complexity analysis of your solution.

Sign in to evaluate