mediumMath & GeometryFacebookGoogle
Giant Number Multiplier
A big-integer library multiplies two arbitrarily long decimal strings without using built-in big-number types.
Given two non-negative integers num1 and num2 represented as strings, return their product as a string.
Choose approach
123
0456
1Mapdigits
0→0
1→0
2→1
3→3
4→6
5→8
1/4
Narrationstep 1 of 4
Processed num1[2] = 3; partial = 001368.
Variables
i=2
partial=001368
How to think about it
- Position i+j accumulates carry; i+j+1 holds units.
- Strip leading zeros at the end.
Edge cases to catch in interview
- "0" × anything -> "0".
- No overflow since digits are base 10.
Examples
Example 1
"6"{"num1":"2","num2":"3","values":["2","3"]}
Try your own input
SpacePlay / pause
← / →Previous / next step
RReset to start
. or >Cycle speed