Mapped string problem


code is giving wrong answer for testcase2

@Ajitverma1503 in the recursive case when you are checking for 2 digit numbers, you also have to check whether num3 is less than or equal to 26 or not.
If num3 comes out to be greater than 26 then you don’t to call the recursive function for num3. For eg, if input is β€œ36”, then you have to print for β€œ3” as well as β€œ6” but not for β€œ36” because there is no mapping for β€œ36” in the array.
I have made the required changes in your code an added the comment as well where the changes are made.


Hope this helps.

thanks for correcting

1 Like