Insert Delete GetRandom O(1) - Duplicates allowed at Meta

Hard36.4% acceptance

This problem has 25.0% frequency at Meta.

Problem Description

`RandomizedCollection` is a data structure that contains a collection of numbers, possibly duplicates (i.e., a multiset). It should support inserting and removing specific elements and also reporting a random element. Implement the `RandomizedCollection` class: * `RandomizedCollection()` Initial...

Read full problem and hints

Topics

Also asked at 11 companies


More Meta Questions

View all Meta questions