← Backtracking

Pattern Recognition Drill

#76 — Letter combinations of phone

Medium Backtracking

The Problem

Given digits 2-9, return all possible letter combinations (phone keypad).

What approach would you use?

Think about it before scrolling down.

Key Signals

Backtracking

For each digit, try each letter. Recurse on remaining digits. Collect at end. O(4^n).

Common Trap

This is a Cartesian product, not permutations. The order of digits is fixed.

← #75 #77 →