Tap here to switch tabs
Problem
Submissions

Problem: Maximum Array Hopping Score II

Maximum Array Hopping Score II asks you to reach the last index of an array from the first. Each forward jump scores its distance times its destination value; return the maximum total.

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

Maximum Array Hopping Score II asks you to reach the last index of an array from the first. Each forward jump scores its distance times its destination value; return the maximum total.

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