Math Fundamentals18 sections · 814 units
Open in Course

Problem - Letter Combinations

(LeetCode 17 - Product rule)

Given a string of digits from 2-9, return all possible letter combinations that the number could represent (like on a phone keypad).

Example: Input "23". Digit 2 maps to "abc", digit 3 maps to "def". Output: ["ad", "ae", "af", "bd", "be", "bf", "cd", "ce", "cf"].

Before reading on, can you count how many combinations exist without generating them?