Ezvor

2297. Jump Game VIII

MediumArray Preparing judge… LeetCode
ArrayDynamic ProgrammingStackGraph TheoryMonotonic StackShortest Path

Hints

Hint 1
For each index, find the indexes that you can jump to.
Hint 2
We can do this by using a monotonic stack and iterating through the array backwards.
Hint 3
Create another integer array of length n called dp where dp[i] is the minimum cost of getting to index i.