Insert Delete GetRandom O(1).
Unlock detailed company stats for this questionUpgrade
A variation of the LeetCode GetRandom() question, with a follow-up adding weights.
Expect follow-ups like
- Support duplicates.
- Handle duplicates allowed (LeetCode 381).
Format · Technical interview.
Also asked as · Implement Insert Delete GetRandom O(1) without duplicates.; Implement Insert Delete GetRandom O(1).; Insert Delete GetRandom O(1), with a removeRandom method instead of getRandom.
Community answers
No answers contributed by the community yet.
Related questions
Implement insert, delete and getRandom in O(1).Design a data structure that supports insert, delete and getRandom in O(1).Related courses

Course

Course
Course



