#3660

Jump Game IX

expert · 1170 · lc medium +32 · 23.9% accepted · 180 likes · top 3%

Description

An integer array nums is given. From index i you may jump forward to index j > i if nums[j] < nums[i], or backward to j < i if nums[j] > nums[i]. For each starting index, find the maximum element reachable through any chain of valid jumps. Return the array of those maximums.

Code

1
2
3