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.