Design a data structure that supports insertion, deletion, search, and retrieving a random element, all in average O(1) time. The getRandom function must return an element with equal probability.
You've read your 3 free write-ups
Sign up free to keep reading. Your account opens the first 10 questions of every company.