Implement RandomizedSet: insert(val) adds val if absent and returns true, otherwise false; remove(val) removes val if present and returns true, otherwise false; getRandom() returns a uniformly random element (at least one element is present). Every operation must run in average O(1) time. Here getRandom is only called when the set holds exactly one element, so the output is deterministic.
Implement RandomizedSet: insert(val) adds val if absent and returns true, otherwise false; remove(val) removes val if present and returns true, otherwise false; getRandom() returns a uniformly random element (at least one element is present). Every operation must run in average O(1) time. Here getRandom is only called when the set holds exactly one element, so the output is deterministic.