Smart Keypad 1 https://ide.codingblocks.com/s/167288

I’m getting run error

u r just doing for 2 length input

what for the input whose length greater than 2?
e.g
input: 5608
o/p :

jm t
jm u
jm v
jn t
jn u
jn v
jo t
jo u
jo v
km t
km u
km v
kn t
kn u
kn v
ko t
ko u
ko v
lm t
lm u
lm v
ln t
ln u
ln v
lo t
lo u
lo v

hope this wll help u
pls rate my work so that i can improve myself

Okkk, can u give me a hint as to how to approach this question… I have no idea

approach is similar to generating the subsequence of string.

e.g: 123

take the first char : 1
and make a call for the rest of the string : 23
then generate all the possible string by merging the chars which are present on keypad 1(first char) with the strings generated by rest string 23.

hope this will help u
pls rate my work so that i can improve myself.

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.

@Shlok,

https://ide.codingblocks.com/s/233571 corrected code.

Approach:

See imagine the old nokia-samsung phones which had buttons. 1-abc, 2-def and so on.
Similarly in this question, you are given the string table[] = { " ", “.+@$”, “abc”, “def”, “ghi”, “jkl” , “mno”, “pqrs” , “tuv”, “wxyz” };

where string corresponding to 0 is " " and 1 is “.+@$” and 2 is “abc”.

Now if input is 12. Means you pressed buttons 1 and 2 what are the possible combinations you can make:

1 has .+@$
2 has abc

So all the possible combinations will be:
.a
.b
.c
+a
+b
+c
@a
@b
@c
$a
$b
$c
Note:We only need to print all the possible combinations arising if we press buttons given in the input string.