Click here to Skip to main content
14,699,500 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
So i have a problem with keypad combinations . What i need help with, is for someone to explain to me, on what could be the easiest way of solving this problem either using recursion or dynamic programming(not asking for code). So the issue is that you have a certain number of presses, which we can assign to "n".

1 press could print "a,d,g,j,m,p,t,w", the count is 8.
2 presses could print "aa,ad,ag,aj,am,ap,at,aw" and so on with every other letter, so the count is 64, but this is where i'm stuck, at this point, when you have 2 presses you can also print "b,e,h,k,n,q,u,x", which means the total count is 64+8.
With 3 presses the count equals to 72*8+64+8=648, since you add the recursions of the letters that appeared later.

And when you have 4 presses, again the last 4 letters show up. The question that i have is, what steps do i have to take, i'm getting lost in the recursion.

What I have tried:

Writing the function recursively.
Posted
Updated 26-Apr-20 6:28am
v6

1 solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900