← Amazon questions

K random elements from N

Filed under Amazon

Given an array or stream of `N` distinct elements and an integer `K` ( where `1 <= K <= N`), randomly select `K` elements such that every subset of size `K` has an equal probability of being chosen…

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.