Diwali Offer!Flat 20% OFF
Enroll Now
PrakalpanaLive online tech training

54. Multiply Strings

MediumDay 16 of 60Strings

You are given two non-negative integers num1 and num2 written as strings. Return their product, also as a string. You may not convert the inputs to built-in big integers or to numbers directly, because they can be far too long.

Example 1
Input: num1 = "2", num2 = "3"
Output: "6"
Example 2
Input: num1 = "123", num2 = "456"
Output: "56088"
Constraints
  • 1 <= num1.length, num2.length <= 200
  • Both contain only digits
  • Neither has leading zeros, except the number "0" itself
Hints
Frequently asked at: Meta, Microsoft, Amazon, Goldman Sachs
Ctrl + Enter runs the examples

Not sure what to learn next?

A 1-on-1 session with an industry mentor and a roadmap built for you. How it works

  1. 1Discuss your goals
  2. 2Get a personal plan
  3. 3Start learning
Book for β‚Ή200/ 30 min