Anthropic

Verified interview challenge

Distributed Mode and Median

Find global statistics when each worker can see only its own data and communicate through messages.

Unlock with Full Access

The challenge

Implement the global mode, then add an exact median calculation in the same Python file. Each worker receives a local shard and supplied send and receive functions. Follow-up discussions explore communication costs, uneven data and different value distributions. Choose guided practice or a 55-minute practice timer.

What you'll practise

  • Global aggregation

    Combine local information without losing values that matter to the global answer.

  • Message coordination

    Design a protocol that works across empty and uneven worker shards.

  • Communication costs

    Compare how your approach moves data as its size and distribution change.

Your coding workspacePreview
Current partFurther parts unlock as you progress
solution.pyPython 3.13
# Build on your implementation

# Run checks for the current part

# Full starter code included
Current-part checks

Run your code to see results.

The complete sequence, starter code and checks are included with Full Access.