Coding - Distributed Machine Cluster Count and Topology
[ OK ]b8e12a1c-55a0-4552-a13f-3df3e4ec7ba9 — full content available
[ INFO ]category: Coding difficulty: medium freq: Must first seen: 2026-03-13
[MEDIUM][CODING][MUST]
$catproblem.md
The Distributed Machine Cluster Count and Topology is a known OpenAI interview problem typically classified as a hard coding or system design question. It focuses on implementing a message-passing protocol to explore a distributed system organized as an nn𝑛-ary tree. 356
Problem Statement
You are given a distributed system of machines representing nodes in a rooted nn𝒏-ary tree. Each node has: 5
A Unique ID (string ID from 000 to 𝑛−1).
Its Parent's ID (-1negative 1−1 for the root).
A list of its Children's IDs.
Communication Constraints: Nodes can only communicate with their immediate parent and children using a provided bi-directional messaging API.
Core Tasks
The objective is to implement a message-based protocol that supports two operations, both triggered by a message sent to the root node: 5
Count Nodes: Calculate the total number of machines in the cluster.
Discover Topology: Reconstruct the entire cluster's structure as a string.
Handling Failures (Follow-up): Address how the protocol maintains consistency if a node or communication link fails during execution. 一亩三分地 +2
Implementation Details
Messaging Protocol: You must define how nodes send, receive, and aggregate information (e.g., child nodes reporting their counts back to their parent).
Concurrency: The solution often requires managing asynchronous messages or parallel processing across the tree branches.
Optimization: Interviewers look for efficient state management to ensure each node only prints or reports the final result once. LeetCode +3
For more practice on similar distributed system challenges, you can explore resources on ShowOffer and Hack2Hire. 23
Would you like to walk through a code structure for the "Count" or "Topology" message handlers?