...
/DIY: Insert, Delete, and GetRandom in O(1)
DIY: Insert, Delete, and GetRandom in O(1)
Solve the interview question "Insert, Delete, and GetRandom in O(1)" yourself in this lesson.
We'll cover the following...
Problem statement
Implement a set data structure that can perform the following operations:
insert(data)
: This function should insertdata
into the set (if the set does not contain it already). It should returnfalse
if thedata
already exists in the set. Otherwise,