Distributed Tree Node Count

Asked at Snowflake · System Design for ML · Difficulty: Hard · Last asked Jun 24, 2026

A rooted tree of servers must count how many servers it has. Each server is a node that can talk only to its parent and its children, over a network that may lose, delay, reorder or duplicate messages. Write the logic that runs on every node so that the root learns the exact total and reports it exactly once.

Loading the problem…