1 Read question2 Draft response3 Review notes
Anthropic · Coding
Distributed Mode and Median
Must priorityMedium
The questionCompute mode and median across a very large distributed dataset.
Executable browser contract: Implement distributed_mode_median(shards). Each shard is sorted in ascending order and may be empty. Merge the shards as a stream, return (mode, median), choose the smallest value when several values share the highest frequency, and return (None, None) when every shard is empty. Reject an unsorted shard.
Try a first passNo account required. Nothing you type here is sent or saved.
Loading the Python editor…
No account required · code is not uploaded or saved
Keep your implementationSave this run and open 12 free Anthropic questions.A free workspace keeps this code and your progress. Upgrade only when you want every Anthropic question and contextual AI review.
Free needs no card. Premium is then $49/month; cancel anytime. Secure checkout follows account creation. Ready to work it, not just read it?Create an anonymous workspace to open the right editor, save your attempt, and track this question.
Practice this question free →