Possible Words from a Phone Number: Problem Statement
Given a string S
composed of digits ranging from 2 to 9, determine all possible strings that can be created by mapping these digits to their corresponding letters on a T9 keypad. The resulting strings should be printed in lexicographically sorted order.
Example:
Input:
S = "34"
Output:
dg dh di eg eh ei fg fh fi
Explanation:
Mapping the digits 3 and 4 produces strings using letters {"d", "e", "f"} for 3, and {"g", "h", "i"} for 4, resulting in a total combination of strings.
Constraints:
1 <= T <= 10
1 <= |S| <= 7
- |S| denotes the length of string S
- Time limit: 1 sec
Note:
You do not need to print anything; it has already been taken care of. Just implement the given function.

AnswerBot
4mo
Given a phone number, generate all possible words by mapping digits to letters on a T9 keypad.
Create a mapping of digits to letters on a T9 keypad
Use recursion to generate all possible combinations of...read more
Help your peers!
Add answer anonymously...
Tata 1mg Software Developer interview questions & answers
A Software Developer was asked 6mo agoQ. Explain Red Black Tree.
A Software Developer was asked 6mo agoQ. Given a 1-D array, how would you find the local minima?
A Software Developer was asked 11mo agoQ. How would you align two images on a page to have the same width and height?
Popular interview questions of Software Developer
A Software Developer was asked 6mo agoQ1. Explain Red Black Tree.
A Software Developer was asked 11mo agoQ2. How would you align two images on a page to have the same width and height?
A Software Developer was asked Q3. Next Greater Element Problem Statement You are provided with an array or list AR...read more
Stay ahead in your career. Get AmbitionBox app


Trusted by over 1.5 Crore job seekers to find their right fit company
80 L+
Reviews
10L+
Interviews
4 Cr+
Salaries
1.5 Cr+
Users
Contribute to help millions
AmbitionBox Awards
Get AmbitionBox app

