← 返回 openai 的题目列表Machine Count and Network Topology Message Delivery (implement receiveMessage)
类型:online_judge
Problem: Message receiving handler with machine count and network topology (implement receiveMessage)
You are given a distributed system with multiple machines and a network topology describing connectivity between machines. Messages are exchanged among machines. Implement a message receiving function receiveMessage(...) that updates local state when a machine receives a message and processes/delivers it according to the required semantics.
What to implement
Implement receiveMessage(...).
The function is invoked whenever a machine receives a message.
Known context (from interview notes; details missing)
You are given the machine count.
You are given the topology (network connectivity).
You are asked to implement receiveMessage without running code.
Things you should make explicit (if not specified, state reasonable engineering assumptions)
Whether messages can be duplicated, reordered, or lost.
Required delivery semantics (e.g., at-most-once / at-least-once / exactly-once).
Ordering constraints (e.g., timestamp order, sequence order, causal order).
Local data structures to maintain (e.g., seen-set, buffers, adjacency map, retry queues).
Output/delivery
When a message becomes deliverable, deliver it to the upper layer (e.g., call deliver(message) or append to a delivered list).
Constraints
Not provided; include complexity discussion and high-throughput considerations in your answer.
Examples
Not provided.