Please help figure it out.
Getting RTE, dont know if approach is right or nor?
Hii, could anyone please have a look into this doubt?
hey ,
this isnt the optimised approach that is why u ll get tle
try this
- Start from the second element, move from right to left and construct the jumps[] array where jumps[i] represents minimum number of jumps needed to reach arr[m-1] from arr[i]
- If arr[i] is 0 then arr[n-1] can’t be reached from here
- If we can direcly reach to the end point from here then jumps[i] is
- Otherwise, to find out the minimum number of jumps needed to reach arr[n-1], check all the points reachable from here and jumps[] value for those points