Reported March 2025
Optiversimulation

Satellite Network Message Propagation

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

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

Optiver reported this one in March 2025, and it looks like a graph problem until you read the timing rules. Then it turns into an event simulation. Up to 10^5 instructions and 2^16 possible satellite IDs mean you can't rescan the whole network on every MESSAGE. You're simulating a BFS-style flood with 10 second forwarding attempts and 30 second processing, and the output order depends on timestamps and ID tie-breaks. If you blank on the event ordering during the live OA, StealthCoder is the safety net sitting invisibly on your screen.

The problem

Maintain an undirected satellite network and simulate message propagation.
SATELLITE id connects a new satellite. If the ID already exists, output ErrDuplicateSatellite: id.
RELATION a b adds a two-way connection.
MESSAGE m id1... idm simultaneously notifies the listed satellites and runs one complete propagation.
An instruction that references nonexistent satellites outputs ErrInvalidSatellite: id once for every distinct invalid ID in left-to-right order, then makes no state change.
Propagation timing
Each notified satellite considers direct neighbors in increasing ID order.
It skips neighbors already known to be notified. It never tries to notify the satellite that notified it.
One forwarding attempt takes exactly 10 seconds, and one sender can have only one attempt in flight.
Two senders may attempt the same target concurrently. Even if another attempt finishes first or at the same time, each in-flight sender still spends its full 10 seconds.
After a sender finishes all required attempts, it spends 30 seconds processing and reports back.
Reports are ordered by time, then by smaller satellite ID.
Return every callback string in invocation order.

Function
simulateSatelliteNetwork(instructions: String[]) → String[]

Examples
Example 1
instructions = ["SATELLITE 1","SATELLITE 2","SATELLITE 3","RELATION 2 1","MESSAGE 1 2"]
return = ["SatelliteReportedBack: 1","SatelliteReportedBack: 2"]
Satellite 2 forwards to 1 for 10 seconds. Both finish processing at time 40, so ID 1 reports first.
Example 2
instructions = ["SATELLITE 1","SATELLITE 2","SATELLITE 3","SATELLITE 4","SATELLITE 5","RELATION 1 3","RELATION 1 2","RELATION 2 5","RELATION 3 2","RELATION 3 4","RELATION 3 5","MESSAGE 2 1 3"]
return = ["SatelliteReportedBack: 1","SatelliteReportedBack: 2","SatelliteReportedBack: 3","SatelliteReportedBack: 4","SatelliteReportedBack: 5"]
Satellites 1 and 3 start together. Concurrent attempts to 2 finish at time 10; all reports at time 50 are ordered by ID.

Constraints
0 <= satelliteId < 2^16
1 <= instructions.length <= 10^5
Each instruction has the documented valid token format.
Repeated relationships and duplicate IDs within one MESSAGE instruction are idempotent.

Reported by candidates. Source: FastPrep

Pattern and pitfall

The pattern is simulation driven by a priority queue keyed on (time, satellite ID). Store adjacency as sorted sets so neighbors come out in increasing ID order. Per MESSAGE, keep a notified set and a parent for each satellite. Each sender walks its neighbors in order, skips already notified ones and its own notifier, and each attempt costs 10 seconds serially. The trap is concurrency. Two senders can target the same node at once, and both still pay the full 10 seconds, so don't cancel an in-flight attempt when the target gets notified elsewhere. Another pitfall is validating a whole instruction before any state change, and reporting each distinct bad ID once in order. Finish time is the last attempt end plus 30. Sort reports by time, then ID. StealthCoder is your hedge if the timing rules tangle you live, but trace Example 2 by hand first.

Drill it cold or hedge it with StealthCoder. Either way, don't walk into the OA hoping you remember the trick.

If this hits your live OA

You can drill Satellite Network Message Propagation 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. Made for the candidate who got the OA invite this morning and has 72 hours, not six months.

Get StealthCoder

Related leaked OAs

⏵ The honest play

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

Optiver reuses patterns across OAs. Made for the candidate who got the OA invite this morning and has 72 hours, not six months. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Satellite Network Message Propagation FAQ

What's the core trick in the Optiver satellite network problem?+

Treat it as a discrete event simulation. Use a min-heap ordered by time then satellite ID, and process attempts as events. Adjacency lists sorted by ID give the neighbor order. The graph part is easy. The timing and tie-break rules are where points get lost.

How hard is this really?+

Medium-hard, mostly from reading comprehension. The data structures are simple, but the rules about concurrent attempts, skipping the notifier, and full 10 second costs create edge cases. Hand-trace both examples before coding, because a one-line misread breaks the report order.

Does input size matter here?+

Yes. With up to 10^5 instructions, you can't rebuild or rescan the network per command in a slow way. Keep adjacency in sets, validate IDs in constant time, and make each MESSAGE cost only the nodes and edges it actually touches.

How should I handle invalid instructions?+

Check every referenced ID first. For each distinct missing ID, in left-to-right order, output the error once. Then change nothing. For SATELLITE with an existing ID, output the duplicate error and skip. Repeated relations and duplicate IDs inside MESSAGE are idempotent, so use sets.

How do I prepare in 48 hours?+

Practice writing a heap-based event loop with tuple ordering, then rehearse this problem's two examples by hand. Focus on tie-breaking and on separating when an attempt ends from when a satellite reports back. Don't spend time on unrelated graph theory.

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

OA at Optiver?
Invisible during screen share
Get it