Problem · String
Letter Combinations of a Phone Number
Learn this problemProblem statement
Digits 2 through 9 map to letters as on a telephone keypad. Return every string formed by choosing one mapped letter for each input digit.
Return an empty list for an empty input, and otherwise return combinations in lexicographic keypad order.
Function
letterCombinations(digits: String) → String[]Examples
Example 1
digits = "23"return = ["ad","ae","af","bd","be","bf","cd","ce","cf"]Choose one of abc for 2 and one of def for 3.
Constraints
0 <= digits.length <= 8- Every character is between
2and9.