Example 1
- Input
- ["RandomizedSet", "insert", "remove", "insert", "getRandom", "remove", "insert", "getRandom"] [[], [1], [2], [2], [], [1], [2], []]
- Output
- [null, true, false, true, 2, true, false, 2]
The output is one possible random outcome: after inserting 1 and 2, getRandom may return either with probability 1/2; this trace chooses 2. Removing 1 leaves only 2. A duplicate insert of 2 returns false, and the final sample must be 2.