LeetCode Question · Mar 2020

Bloomberg | Phone | Reservoir Sampling

2 upvotes 2,107 views 5 replies

Question Details

Given a distinct array of elements. Find n non-repeating random elemnents. For ex: [2,4,1,-19,56,23,0,34,112,5] , n =3 Output: [112,56,23] Constraints: 1) Each number has to get equal chance to be in the random...

Full Details

🔒

Unlock full leaked content

Full insider details, leaked discussions, and candidate experiences.

Get Premium →

Topics

Arrays