Minimum jumps required

what is wrong in my code?
it is giving correct output when i dont use dp in it and after using it , it gives wrong answer.

Hi @sktg99
The if condition that you have used is giving wrong ans.

if (dp[i] != -1) return dp[i];

Omit this out you will get all test cases passed.

im trying to use dp here and u are telling me to remove that???

tell me whatis wrong in that dp part

Hi @sktg99
To use DP you have to make few changes :

Instead of passing mini as argument you can just make a single change as (1+jumps(a, n, i + u)).
Kindly have a look on the code that i have shared.