sir i am not getting how to approach this problem
can you give some hint
Smart Keypad 1 problem
If the number is 23
Then for 2, the alphabets are a, b, c So 3 recursive function will be called with output string as a, b, c respectively and
for 3 there are 3 alphabets d, e, f So, the output will be ad, ae and af for the recursive function with output string.
Similarly, for b and c, the output will be: bd, be, bf and cd, ce, cf respectively.
Algorithm:
- Map the number with its string of probable alphabets, i.e 2 with “abc”, 3 with “def” etc. using array of string
- create a recursive function which takes following parameters, output string, number array, current index and length of number array
- If the current index is equal to the length of number array then print the output string.
- Extract the string at digit[current_index] from the Map, where digit is the input number array.
- Run a loop to traverse the string from start to end
- For every index again call the recursive function with the output string concatenated with the ith character of the string and the current_index + 1.
i hope this helps
if yes hit a like and don’t forgot to mark doubt as resolved
if you have more doubts regarding this feel free to ask