Tap here to switch tabs
Problem
Submissions

Problem: Maximum Array Hopping Score I

Maximum Array Hopping Score I asks you to travel from the first to the last array index, choosing forward jumps to maximize the total of each jump’s squared distance times its destination value.

Statement

You are given an integer array nums.

Starting at index 00, you can jump from your current index i to any index j such that i < j. The score obtained from jumping from index i to index j is (j−i)×(j - i) \times nums[j].

You can perform any number of jumps until you reach the last index of nums.

Return the maximum total score you can achieve.

Constraints:

  • 2≤2 \leq nums.length ≤103\leq 10^3

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

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Maximum Array Hopping Score I

Maximum Array Hopping Score I asks you to travel from the first to the last array index, choosing forward jumps to maximize the total of each jump’s squared distance times its destination value.

Statement

You are given an integer array nums.

Starting at index 00, you can jump from your current index i to any index j such that i < j. The score obtained from jumping from index i to index j is (j−i)×(j - i) \times nums[j].

You can perform any number of jumps until you reach the last index of nums.

Return the maximum total score you can achieve.

Constraints:

  • 2≤2 \leq nums.length ≤103\leq 10^3

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