Practice Letter Combinations of a Phone Number
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
Given a string of digits from 2 through 9, return every letter combination obtained by choosing one letter for each digit in order. The telephone mapping is 2: abc, 3: def, 4: ghi, 5: jkl, 6: mno, 7: pqrs, 8: tuv, and 9: wxyz. Return the combinations in any order. Digit 1 has no associated letters.
Source: Letter Combinations of a Phone Number on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
Input
digits = "23"
Output
["ad","ae","af","bd","be","bf","cd","ce","cf"]
# Example 2
Input
digits = ""
Output
[]
# Example 3
Input
digits = "2"
Output
["a","b","c"]
Constraints
0 <= digits.length <= 4
digits[i] is a digit in the range ['2', '9'].
Related LeetCode Problems
Practice more problems similar to Letter Combinations of a Phone Number.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.