Interview Questions/Coding/Edge Draft Multiplier Score

Edge Draft Multiplier Score

Preview mode. Log in to edit, run, submit, and save progress.

Hard

Edge Draft Multiplier Score

A scoring engine has a row of signed values and a list of multipliers. On each operation, the engine must remove exactly one value from either the left edge or the right edge of the remaining row. The removed value is multiplied by the current multiplier, and that product is added to the total score. Multipliers are used in their given order. Once all multipliers have been used, the process stops even if values remain in the row. Input Format: You are given an integer array values and an integer array multipliers. Output Format: Return the maximum score obtainable after all multiplier operations are completed.

Examples

Example 1
Input:
values = [1, 2, 3]
multipliers = [3, 2, 1]
Output:
14

Explanation: One optimal edge-pick order gives 3*3=9 + 2*2=4 + 1*1=1 = 14. No other left/right sequence scores higher, so the answer is 14.

Approach hint

Look for the state that actually matters after each operation.

Common mistake

Skipping assumptions, edge cases, or trade-offs can make an otherwise good answer feel incomplete.

solution.cpp