Oracle SDE Interview Question 2021 April | System Design (O(1) Data Structures) | On-campus
Oracle · Question · Posted Jun 2026
Question 1: Insert Delete GetRandom O(1) - Duplicates allowed Problem Statement 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 returning a random element. Implement the RandomizedCollection class: RandomizedCollection() Initializes the empty RandomizedCollection object. boolean insert(int val) Inserts an item val into the multiset, even if the item is already present. Returns true if the item is not present, false otherwise. boolean remove(int ...
The full answer & interview discussion are available to premium members.
Log in Create a free account