3221. Maximum Array Hopping Score II
ArrayStackGreedyMonotonic Stack
Hints
Hint 1
It’s always optimal to jump to index
j with the maximum value.Hint 2
Keep an array
suffixMax and store the maximum of each suffix of the array along with its index.Preparing judge…