challenges-Recursion , Mapped Setting

plz explain this ques in detail

@sameeksha,

You have a mapped string and are provided a number now you need to find the possible strings that can be created. You can do this recursively take the digit write its mapped string make a recursive call for remaining, then take the digit and adjacent digit and make the recursive call for remaining.
eg Number is 123
1- A call for(23)
2-B call for(3)
3 C
String ABC
returning to 2, take 23 -W
String AW
return to 1
Take 12 call 3
12- L ,3=C
String LC

Final answer
ABC
AW
LC

  • Bigger Problem : To Print all of the possible mapped String of given number.
  • Smaller Problem : Assume the recursion works and will give you ans for just after the first digit.
  • Self Work : In order to make you smaller prblm your problem all you need to work for the 0th index element. Because it could be the part included in the answer or not. So first number could be mapped as it is or can be mapped by including just the next digit with. For e.g…, 123 either first digit will be mapped as ‘1’ or as ‘12’ but not for ‘123’

Note : Do handle that the number should be smaller than 26 as for two digit number could be like 321 so your recursion will take either 3 or 32 but 32 is not valid.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.