Dashboard
LC #17

Letter Combinations of a Phone Number

Pattern · ?AmazonGoogleMetaBloomberg

Problem

Return all possible letter combinations that a phone number could represent.

Constraints

  • 0 ≤ digits.length ≤ 4
  • digits[i] is in ['2','9']

Example

Input
digits = "23"
Output
["ad","ae","af","bd","be","bf","cd","ce","cf"]
Why
2→abc, 3→def. All combinations: 3×3 = 9

Spot the pattern

Which pattern cracks it?

Hints

One at a time
Solve on LeetCode ↗