Tap here to switch tabs
Problem
Submissions

Problem: Maximum Array Hopping Score II

Try to solve the Maximum Array Hopping Score II problem.

Statement

You are given an integer array nums.

You start at index 00 and want to reach index nums.length −1- 1. From your current index i, you can jump to any index j such that i <j< j. The score obtained from jumping from index i to index j is (j−i)imes(j - i) imes nums[j].

Return the maximum total score you can achieve by jumping to the last index.

Constraints:

  • 2≤2 \leq nums.length ≤105\leq 10^5

  • 1≤1 \leq nums[i] ≤105\leq 10^5

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Maximum Array Hopping Score II

Try to solve the Maximum Array Hopping Score II problem.

Statement

You are given an integer array nums.

You start at index 00 and want to reach index nums.length −1- 1. From your current index i, you can jump to any index j such that i <j< j. The score obtained from jumping from index i to index j is (j−i)imes(j - i) imes nums[j].

Return the maximum total score you can achieve by jumping to the last index.

Constraints:

  • 2≤2 \leq nums.length ≤105\leq 10^5

  • 1≤1 \leq nums[i] ≤105\leq 10^5