Insert Delete GetRandom O(1)
Implement RandomizedSet supporting average O(1) time operations:
insert(val) -> bool: Insertvalif not present and returnTrue; otherwise returnFalse.remove(val) -> bool: Remove ...
Example
Unlock to view complete problem details
and practice with sample input/output
Was this article helpful?
View Test Cases & Run Code requires membership
Standard Input
Execution Result:
