LeetCode 43, Medium. Topics: Math, String, Simulation. View on LeetCode.
Generate this problem as a practice environment: tested reference solution, 16 parametrized pytest cases, and a playground notebook:
Problem
Given two non-negative integers num1 and num2 represented as strings, return the product of num1 and num2, also represented as a string.
Note: You must not use any built-in BigInteger library or convert the inputs to integer directly.
Examples
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.
Solution
Reference implementation from solution.py on GitHub, full suite in test_solution.py:
Complexity
NeetCode 150, NeetCode 250, NeetCode All. Last modified on September 7, 2026