Reported September 2026
Pure Storagesimulation

One-Shot Callback Event Dispatch

Reported by candidates from Pure Storage's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.

Get StealthCoderRuns invisibly during the live Pure Storage OA. Under 2s to a working solution.
Founder's read

The Pure Storage OA reported in September 2026 dresses a simple queue simulation up as a concurrency problem. One-Shot Callback Event Dispatch sounds scary because of the "linearization" language, but the array order already settles every race for you. If you've got an assessment coming in the next day or two, relax. It's a single pass with a pending list and a fired flag. The only real work is reading the spec carefully and getting the output rows right. StealthCoder sits invisibly on your screen as a safety net if you blank mid-assessment, but you probably won't need it for this one.

The problem

Simulate a one-shot callback event over the linearized operation list operations. Each operation is one of:
["REGISTER", callbackId]: register one callback occurrence. Before the event fires, retain the occurrence for later execution and emit an empty row. After the event fires, execute that occurrence immediately and emit [callbackId].
["FIRE"]: mark the event as fired, execute every retained callback occurrence in registration order, clear the pending queue, and emit the executed callback IDs as one row.
The input contains exactly one FIRE. Registering the same callbackId more than once creates separate callback occurrences, and each occurrence executes exactly once.
The array order is the chosen linearization order for calls that may have originated concurrently. Return one output row per input operation. The task evaluates the observable one-shot semantics from this linearization; no actual multithreading is required.

Function
dispatchCallbacks(operations: String[][]) → String[][]

Examples
Example 1
operations = [["REGISTER","a"],["REGISTER","b"],["FIRE"],["REGISTER","c"]]
return = [[],[],["a","b"],["c"]]
The first two callbacks wait. FIRE executes them in registration order, and the later registration executes immediately.
Example 2
operations = [["FIRE"],["REGISTER","x"],["REGISTER","x"]]
return = [[],["x"],["x"]]
No callback is pending when the event fires. Both later registrations execute immediately, including the repeated identifier as a separate occurrence.

Constraints
1 <= operations.length <= 100000.
Exactly one operation is FIRE.
Every other operation is REGISTER with exactly one callback ID.
Each callback ID contains 1 to 30 ASCII letters, digits, or underscores.
The total number of callback-ID characters is at most 1000000.

Reported by candidates. Source: FastPrep

Pattern and pitfall

The trick is that there's no real concurrency. Walk the operations once and keep two things: a boolean fired and a list of pending IDs. On REGISTER before fire, append the ID to pending and emit an empty row. On REGISTER after fire, emit a row with just that ID. On FIRE, set fired, emit a copy of pending in order, then clear it. The classic pitfall is emitting a reference to the pending list and then clearing it, which wipes your output row. Copy it first. Another miss is deduplicating repeated IDs, but each occurrence is separate, so don't use a set. Return one row per input operation, including empty rows. Runtime is O(n) with total output bounded by the character limit. If you freeze on the output format, StealthCoder is the hedge during the live OA, but the logic is a dozen lines.

StealthCoder is the hedge for the one pattern you didn't drill. It runs invisibly during the screen share.

If this hits your live OA

You can drill One-Shot Callback Event Dispatch cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. If you're reading this with an OA window open, you're who this was built for.

Get StealthCoder

Related leaked OAs

⏵ The honest play

You've seen the question. Make sure you actually pass Pure Storage's OA.

Pure Storage reuses patterns across OAs. If you're reading this with an OA window open, you're who this was built for. Works on HackerRank, CodeSignal, CoderPad, and Karat.

One-Shot Callback Event Dispatch FAQ

How hard is One-Shot Callback Event Dispatch really?+

Easy. It's a linear simulation with one boolean and one list. The wording about linearization and concurrency is camouflage. Once you see that the array order is the execution order, the code is about ten lines. Most of the risk is careless output formatting.

What's the trick to solving it?+

Keep a pending list and a fired flag. Before FIRE, REGISTER appends to pending and outputs an empty row. After FIRE, REGISTER outputs a single-element row. FIRE outputs a snapshot of pending, then clears it. That's the whole algorithm.

Should I deduplicate repeated callback IDs?+

No. The statement says registering the same ID more than once creates separate occurrences, and each executes exactly once. Example 2 shows x executing twice. Use a plain list, not a set or map, and preserve registration order.

What edge cases break most solutions?+

Clearing the pending list after putting a reference to it in the output, which empties your FIRE row. Also FIRE appearing first, where pending is empty and the FIRE row is empty. Make sure every operation produces exactly one row, even if it's empty.

How do I prepare for this in 48 hours?+

Don't grind. Practice a few queue and simulation problems where you process events in order and emit results per step. Write this one by hand once with both examples. Check your complexity is O(n), and confirm you copy the list before clearing it.

Problem reported by candidates from a real Online Assessment. Sourced from a publicly-available candidate-aggregated repository. Not affiliated with Pure Storage.

OA at Pure Storage?
Invisible during screen share
Get it