Object-Oriented Programming · LinkedIn · Hard
Problem: Randomized Set with TTL (follow-up) Create a data structure with these operations: insert(x): Add x to the collection. Return false when x is already present; otherwise add it and return true. remove(x): Delete x from the collection. Return false if no such element exists; otherwise delete it and return true. getRandom(): Produce one element chosen uniformly from all elements currently in the set. The target is an average running time as close to O(1) as practical.…
Checking your access…