DIY: Insert, Delete, and GetRandom in O(1)
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,
Create a free account to view this lesson.
Continue your learning journey with a 14-day free trial.
By signing up, you agree to Devpath's Terms of Service and Privacy Policy