Ctrl K

Multiplying Digit Strings

Medium
Two non-negative integers are written as digit strings, left and right. They can be long, up to 200 digits. Return their product, also as a string with no leading zeros. Do not convert the strings to integers with built-in tools or use any big-number library: multiply digit by digit, the way you would on paper.
Example 1
left="12", right="34" → '408'

12 × 34 = 408.

Example 2
left="999", right="0" → '0'

Anything times zero is zero, written without leading zeros.

Example 3
left="25", right="4000" → '100000'
Constraints
  • 1 ≤ len(left), len(right) ≤ 200
  • The strings contain digits only
  • No leading zeros, except for the number 0 itself
Have you seen this problem in a real interview?
Solved by0
Tried by0
Submissions0
Acceptance—
Topics
Similar problemsMultiply Complex Numbers in Strings MediumTotal of a Fraction Chain MediumSolve for x MediumRover on Repeat MediumSum of Binary Strings Easy
loading Python…
Input
left="12", right="34"
Expected
'408'

Run checks the first 3 tests in your browser. Submit checks all 74 tests on the server, hidden ones included.