Reported interview periodOct 2025–Aug 2026
Compute Mode and Median Across Distributed Shards
The same function runs on N workers. Each worker can read only its local shard of signed integers and communicate using send, recv, and barrier. Worker 0 returns the final answer; other workers return None.
Practice focusRequired results - Mode: the globally most frequent value; break ties by choosing the smaller value. - Median: the middle value for odd cardinality and the mean of the two middle values for even cardinality. - Every worker must participate in a protocol that terminates without unmatched receives or barriers. - Avoid sending complete shards when a smaller exact representation is available. Assume at least one value globally, though individual shards may be empty. Values are signed 64-bit integers.…