Skip to content

Multiply Strings

MediumBit Manipulation & Math
Decode it first. Clues, constraints, pattern and plan before any code.

num1 and num2 are non-negative integers written as decimal strings. Return their product, also as a string. Do not convert the inputs to integers directly or use a big-integer library: multiply digit by digit.

num1 = "2",   num2 = "3"    →  "6"
num1 = "123", num2 = "456"  →  "56088"
num1 = "0",   num2 = "52"   →  "0"

Constraints

  • 1 <= num1.length, num2.length <= 200
  • num1 and num2 consist of digits only.
  • Neither number has leading zeros, except the number 0 itself.