Design a set supporting insert, remove and 'give me a uniformly chosen member', all in average O(1).
insert(value) — returns true if the value was not already there, otherwise false and nothing changesremove(value) — returns true if the value was there, otherwise falsegetRandom() — returns one of the current members- Testability: the constructor takes an optional
pick function (n) => index that chooses an index in 0..n-1. When it is omitted, default to a uniform random choice - You may not scan the collection in
remove or getRandom