Stream Sampling & Distribution Verification

Asked at Perplexity · Coding Questions · Difficulty: Medium · Last asked Nov 19, 2025

Build a one-pass random sampler for a data stream of unknown length, then measure whether its output is uniform. The stream may be too large to store, so the sampler may keep only about `k` items in memory.

Loading the problem…