Implement a data structure supporting insert, delete and getRandom in O(1) (LeetCode 380).
Asked in the onsite stage. LC link given.
Implement randomized_set(operations). Each operation is ['insert', value], ['delete', value], or ['getRandom']. Return a result for each operation: insertion and deletion return booleans, while getRandom returns any currently stored value. Inputs never call getRandom when the set is empty.
getRandom is never called when the set is empty.def randomized_set(operations):