I cannot find the way to solve the problem. In that Situation what to do.
In some I don't know from where to start?
Hi @ravi.cs18, don’t be disheartened take such problem as learning experience so that next time u encounter this or any similar problem you would be able to solve it . now coming to the question
this problem can be solved by dp in which from each position ‘i’ you have choice to jump to position ‘j’ such that ‘j’-‘i’<=k. Let’s define dp[i] as number of ways to reach end from position i. By now, recursion is quite obvious which is: dp[i]=sum(dp[j]) , i+1<=j<=n.
try to implement this yourself
Implementation : https://ide.codingblocks.com/s/213869
In case of any doubt feel free to ask
If you got the answer then mark your doubt as resolved
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.