Risk-Priority Detection Store
Updated
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.
More Crowdstrike interview questions
Similar questions at other companies
- Business Account KYC Verification — Parts 1–5Stripe · PHONE SCREENStripe interview questions
- In-Memory Filesystem CommandsPerplexity AI · PHONE SCREEN · ONSITE INTERVIEWPerplexity AI interview questions
- Route Pattern MatcherGoogle · PHONE SCREEN · ONSITE INTERVIEWGoogle interview questions
- File Storage ServiceCresta · PHONE SCREENCresta interview questions
- String Interpolation with a Missing-Value ModeMongoDB · PHONE SCREENMongoDB interview questions
- Dasher Pay with Store Waits and Peak HoursDoorDash · PHONE SCREENDoorDash interview questions
- Return Every Matching DecryptionDuolingo · PHONE SCREENDuolingo interview questions
- Design a Food Rating SystemApple · PHONE SCREENApple interview questions
- Key-Value Store on a Block DeviceLambda · PHONE SCREEN
- Fixed-Order Task Run Time With CooldownWaymo · PHONE SCREENWaymo interview questions