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 hintsTopics
Also asked at 11 companies
More Meta Questions
Kth Largest Element in an ArrayMediumTwo SumEasyPow(x, n)MediumMerge IntervalsMediumMerge Sorted ArrayEasy
View all Meta questions