Search
⌘K

Leetcode 2770. Maximum Number of Jumps to Reach the Last Index

Given nums and target, you may jump from i to any j>i if nums[j]-nums[i] lies in [-target, target]; compute the maximum number of jumps to reach index n-1 (or -1 if unreachable). This is the longest-path problem on an index-ordered DAG (edges only go to higher indices), solvable with DP given n ≤ 1000.


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Your account is free and you can post anonymously if you choose.