I passed two sample test cases …its also printing dp fine…
let me know if there is some indexing problem or i implemeneted logic wrong
I am calculating min jumps from ith index with arr[i] value at max as +1 +value requird to reach i
I passed two sample test cases …its also printing dp fine…
let me know if there is some indexing problem or i implemeneted logic wrong
I am calculating min jumps from ith index with arr[i] value at max as +1 +value requird to reach i
Hello @piyush.bansal8158625,
You can see the modification in approach that i have done:
Please, refer to the comments for better understanding.
Hope this would help.
Give a like if you are satisfied.
I got your solution but what was wrong in my code. The dp matrix shows that we are going right
Hello @piyush.bansal8158625,
The approach of your and my code is same except
you are checking for reaching 0th index and i have done it to reach the last i.e.(n-1)th index.
Due you think that the minimum path for going in both direction would be same?
No, they won’t because
the index(elements) that you might use while going from left to right in the array might not necessarily be same for going from right to left.
Hope, it is clear now.
i got the approach. If possible please resolve my other doubts of graph and dp
@piyush.bansal8158625 Sure,
I’ll take it later after coming back from important work.
Some other TA will surely resolve your doubt soon.
For now please mark this doubt as resolved.