← Amazon questions

Reservoir sampling

Filed under Amazon · Also reported at Tower Research LLC

Write a class that takes a stream of elements of unknown or large length and returns a uniformly random sample of size k from the stream seen so far using reservoir sampling.

You've read your 3 free write-ups

Sign up free to keep reading. Your account opens the first 10 questions of every company.

Related Amazon questions

Collected from public candidate posts and coding forums. Updated Nov 2026.