FastPrepSelect K Paired Indices for Maximum Score
Problems/Select K Paired Indices for Maximum Score

Select K Paired Indices for Maximum Score

Amazon logoAmazon● MediumFULLTIMEONSITE INTERVIEW
QuestionFunctionExamplesConstraints

Problem statement

Source note: The reported task identifies this algorithmic exercise. The executable interface, bounds, deterministic tie rules, and examples are the documented practice contract.

Select exactly k shared indices from two equal-length arrays. The score is the sum of selected values from first multiplied by the minimum selected value from second.

Return the maximum score.

Function

maximumPairedScore(first: int[], second: int[], k: int) → int

Examples

Example 1

first = [1,3,3,2]second = [2,1,3,4]k = 3return = 12

Case 1 exercises the documented deterministic contract.

Example 2

first = [4,2,3,1,1]second = [7,5,10,9,6]k = 1return = 30

Case 2 exercises the documented deterministic contract.

Example 3

first = [2,1,14,12]second = [11,7,13,6]k = 3return = 168

Case 3 exercises the documented deterministic contract.

Constraints

  • 1 <= k <= first.length == second.length <= 100000.
  • All values are positive integers.
  • The answer fits a signed 32-bit integer.

More Amazon problems

  • Count Adjacent Symbol Pairs for BPEONSITE INTERVIEW · Seen Nov 2026
  • First Non-Repeating CharacterOA · ONSITE INTERVIEW · Seen Nov 2026
  • Lowest Common Ancestor in an N-ary TreePHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
See Amazon hiring insights
Saved
class Solution {
    public int maximumPairedScore(int[] first, int[] second, int k) {
        // Write your code here.
    }

}
Checking account…