Multiply Strings

Asked byFacebookMicrosoftAmazonGoogleTwo SigmaAdobe

Problem

Given two non-negative integers represented as strings, return their product, also as a string, without converting the entire inputs directly to integers or using a built-in big-integer library.

Examples

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

Solve it in the editor. Sign in free to run your Python or JavaScript against test cases, get a verdict, and track your attempts.

Solve on FeatCode →

How to approach it: the Math & Geometry pattern

A grab-bag of problems solved with numeric or coordinate reasoning rather than a specific data structure — matrix manipulation, simulation, and basic number theory.

Look for this pattern when

  • The problem operates on a 2-D grid or matrix directly (rotate, transpose, traverse in a pattern).
  • There's no obvious "textbook" data structure — the problem is really about careful step-by-step simulation.

Read the full Math & Geometry guide →

Video walkthroughs

Original problem on LeetCode ↗

More Math & Geometry problems