Tap here to switch tabs
Problem
Submissions

Problem: Maximum Score from Performing Multiplication Operations

Try to solve the Maximum Score from Performing Multiplication Operations problem.

Statement

You are given two integer arrays, nums and multipliers, of lengths n and m respectively, with elements indexed starting at 00.

You start with an initial score of 00 and must execute exactly mm operations. For each operation ii from i=0i = 0 to i=m−1i = m - 1:

  • Pick one integer xx from either the beginning or the end of nums.

  • Add x * multipliers[i] to your total score.

  • Remove xx from nums.

Return the maximum total score achievable after completing all mm operations.

Constraints:

  • n == nums.length

  • m == multipliers.length

  • 1≤1 \leq m ≤300\leq 300

  • m ≤\leq n ≤105\leq 10^5

  • −1000≤-1000 \leq nums[i], multipliers[i] ≤1000\leq 1000

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Maximum Score from Performing Multiplication Operations

Try to solve the Maximum Score from Performing Multiplication Operations problem.

Statement

You are given two integer arrays, nums and multipliers, of lengths n and m respectively, with elements indexed starting at 00.

You start with an initial score of 00 and must execute exactly mm operations. For each operation ii from i=0i = 0 to i=m−1i = m - 1:

  • Pick one integer xx from either the beginning or the end of nums.

  • Add x * multipliers[i] to your total score.

  • Remove xx from nums.

Return the maximum total score achievable after completing all mm operations.

Constraints:

  • n == nums.length

  • m == multipliers.length

  • 1≤1 \leq m ≤300\leq 300

  • m ≤\leq n ≤105\leq 10^5

  • −1000≤-1000 \leq nums[i], multipliers[i] ≤1000\leq 1000