Problems

12. Letter Combinations of a Phone Number

MediumBacktrackingAmazonGoogle

Given a string containing digits from 2 to 9, return all possible letter combinations that the number could represent.

Example 1:

Input: digits = "23"
Output: ["ad","ae","af","bd","be","bf","cd","ce","cf"]

Example 2:

Input: digits = ""
Output: []

Constraints:

  • 0 <= digits.length <= 4
  • digits[i] is a digit from 2 to 9.
Core code mode
● Auto-savedLine 1, column 1