FastPrepRepeated Maximum and Minimum Request Score
Problems/Repeated Maximum and Minimum Request Score

Repeated Maximum and Minimum Request Score

Amazon logoAmazon● MediumINTERNOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Amazon Experience 37 says that each request adds the current maximum and minimum of the array to a result, then lowers the maximum by one, using max and min heaps. It was an online assessment. The report asks for the total result but does not say how to tell tied values apart or give limits. Tied values are the same, so we lower any one copy of the maximum. Our version is about 96% the same as the reported question.

You are given an integer array values and a count requests. Process requests operations, one after another. In each operation:

  1. Find the current smallest value and the current largest value.
  2. Add those two values to a running score.
  3. Pick one copy of the current largest value and decrease it by 1.

Return the score after all requests. If several entries tie for the largest value, it does not matter which one you pick. The next operation sees the same collection of values either way.

Function

maximumMinimumRequestScore(values: int[], requests: int) → long

Examples

Example 1

values = [3,1,4]requests = 2return = 9

The first request adds the largest and smallest values: 4 + 1 = 5. The largest value then drops by one. The second request adds 3 + 1 = 4. The total is 9.

Example 2

values = [5]requests = 3return = 24

The single element is both the smallest and the largest value, so each request adds it twice. It drops by one after each request, so the requests add 10, 8, and 6. The answer is their total.

Example 3

values = [1,1,1]requests = 4return = 4

The first request adds one plus one and lowers one entry to zero. From then on, zero is the smallest value. The next two requests each add one, and each lowers another entry to zero. The last request adds nothing, so the total is four.

Constraints

  • 1 <= values.length, requests <= 100000.
  • -10^9 <= values[i] <= 10^9.
  • The final score fits in a signed 64-bit integer.

More Amazon Online Assessment questions

  • Maximize K-Element AND with an Increment BudgetOA · Seen Nov 2026
  • Task SchedulerOA · PHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Top K Frequent ElementsOA · PHONE SCREEN · Seen Nov 2026
  • Get Smallest Base SegmentOA · Seen Nov 2026
  • Minimum Cost of Left and Right PropagationOA · Seen Nov 2026
  • Minimum Grid InconvenienceOA · Seen Nov 2026
  • Maximize Shipment Order by Sorting One WindowOA · Seen Nov 2026
  • Maximum Equal-Bit Pairs in a SubsequenceOA · Seen Nov 2026
  • First Non-Repeating CharacterOA · ONSITE INTERVIEW · Seen Nov 2026
  • Two SumOA · PHONE SCREEN · Seen Nov 2026

Similar questions at other companies

  • Find Total WeightJP Morgan Chase · OAJP Morgan Chase interview questions
  • Update Pod Counts From LogsSalesforce · OASalesforce interview questions
  • Apply Binary State OperationsZipRecruiter · OAZipRecruiter interview questions
  • Shortest-Job-First Process SchedulingByteDance · PHONE SCREENByteDance interview questions
  • Dynamic Batch Completion TimesAmbience Healthcare · PHONE SCREEN
  • Automation Pipeline, Part 3: Stage DurationPlaid · PHONE SCREENPlaid interview questions
  • Cursor-Based Pagination Over Sorted LogsRoblox · ONSITE INTERVIEWRoblox interview questions
  • Issue and Reuse 16-Bit TokensMeta · ONSITE INTERVIEWMeta interview questions
  • Finish Ordered CPU Tasks with the Fewest CPUsGoogle · PHONE SCREENGoogle interview questions
  • Weighted Server Load Balancer with TTLStripe · ONSITE INTERVIEWStripe interview questions

Interview reports that mention this question

  • Amazon Intern OA Problems: Every Task We Have (Part 2 of 5)

Amazon interview experiences

  • Amazon Experienced SDE Onsite Questions: 1 Experience
  • Amazon SDE Onsite Interview Questions: 9 Experiences
  • Amazon SDE II and L5 FDE Interview Questions: 4 Experiences
  • Amazon Full-Time OA Problems, Earlier Reports (Part 5 of 5)
  • Amazon Full-Time OA Problems, Recent Reports (Part 4 of 5)
See Amazon hiring insights
Saved
class Solution {
    public long maximumMinimumRequestScore(int[] values, int requests) {
      // write your code here
    }
}
Checking account…