Employee Ratings Management System
Problem statement
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.