FastPrepEmployee Ratings Management System
Problems/Employee Ratings Management System

Employee Ratings Management System

Amazon logoAmazon● HardFULLTIMEPHONE SCREEN
QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in an Amazon SDE2 interview list as an efficient employee-ratings data structure with add, shifting delete, and earliest-maximum queries. The brief report leaves the operation lifecycle and input/output format unstated. This exercise starts from an empty list, appends additions, uses valid zero-based deletion indices, and returns [maximumRating, earliestIndex] for each query made while the list is non-empty. Problem match confidence: approximately 90%.

Process a sequence of operations on an initially empty ordered list of employee ratings. Operation [1, rating] appends a rating. Operation [2, index] deletes the rating at the current zero-based index, shifting later indices left. Operation [3] queries the maximum rating and its earliest current index.

Return one row [maximumRating, earliestIndex] for every query operation. Every deletion index is valid, and every query occurs while at least one rating exists.

Function

employeeRatings(operations: int[][]) → int[][]

Examples

Example 1

operations = [[1,5],[1,7],[1,7],[3],[2,1],[3]]return = [[7,1],[7,1]]

The first maximum is at index 1; after deleting it, the remaining 7 shifts to index 1.

Example 2

operations = [[1,-2],[3],[1,4],[3]]return = [[-2,0],[4,1]]

Queries reflect both negative and later positive ratings.

Example 3

operations = [[1,3],[1,1],[2,0],[3]]return = [[1,0]]

Deleting index zero shifts the remaining rating to zero.

Constraints

  • 1 ≤ operations.length ≤ 100000.
  • Each operation is exactly one of [1, rating], [2, index], or [3].
  • -10^9 ≤ rating ≤ 10^9.
  • Deletion indices and non-empty query preconditions are valid.

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[][] employeeRatings(int[][] operations) {
        // write your code here
    }
}
Checking account…