← Math / Number Theory

Pattern Recognition Drill

#122 — Multiply Strings

Medium Math & Geometry

The Problem

Given two numbers represented as strings, return their product as a string.

What approach would you use?

Think about it before scrolling down.

Key Signals

Math / Number Theory

Result has len(n1)+len(n2) digits. Multiply each pair, add to position i+j+1. Handle carries. O(m*n).

Common Trap

Indexing: digit at position i times digit at position j contributes to result position i+j and i+j+1.

← #121