Elephant Ways 2D DP

Please figure out the problem in this and help me in solving this.

@ayushmittal628_58414ee9c56e4875
corrected code -->

Sir, in the updated code, 1st row and 1st column is initialized with 1, but in this problem (elephant can take k steps ie- it can take 2 steps at one go, 3 steps at one go … and so on) so logic would be incorrect if we initialized 1st row and column as 1
And the count of ways to reach destination would be different.

Oh okay… Will send the updated code


made the changes…

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.

Thank You so Much Sir

1 Like