Design an O(1) Insert, Delete, and GetRandom Data Structure

Design a RandomizedSet that stores unique integers and supports these operations:

  • put(val): Insert val. Return false if it already exists; otherwise insert it and return true.
  • `delete(v...

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: