Dsa
Trie
Easy
Phone Number Combinations
Given a string of digits representing a phone number, return all possible letter combinations that can be formed based on the mapping on a standard phone keypad. Implement a Trie to manage the combinations.
Input Format:
The input is a string of digits, where each digit is between '2' and '9'. The length of the string will be between 1 and 10 digits long.
Output Format:
Print all possible combinations that can be formed, one per line in lexicographical order.
Example:
Input:
23
Output:
ad
ae
af
bd
be
bf
cd
ce
cf
Key concepts
triecombinationsphone numbers
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now