Build a set that inserts, removes and returns a uniformly random element, all in average O(1) — then allow duplicates.
Build a set that inserts, removes and returns a uniformly random element, all in average O(1) — then allow duplicates.
Opens with the full question.