Risk-Priority Detection Store
Problem statement
Process operations "PUT id score" and "GET". PUT inserts or replaces the detection with that id. GET removes and returns the id with the highest risk score; break ties by lexicographically smaller id. Return an empty string for GET on an empty store.
Return the sequence of GET results.
Function
processDetections(operations: String[]) → String[]Examples
Example 1
operations = ["PUT a 5","PUT b 9","GET","GET"]return = ["b","a"]The higher-risk detection is returned first.
Example 2
operations = ["GET"]return = [""]An empty store returns the empty sentinel.
Constraints
1 <= operations.length <= 5000.- Ids are nonempty lowercase strings; scores are nonnegative 32-bit integers.
Source note: Author-written prompt excerpt retained for source fidelity.