InterviewDigestInterviewDigest

OA Practice Workspace

Technical2026-08-16

Create a data structure with O(1) time for insert, delete, contains, and get random

AI-Expanded — inferred from the question title, not from the original candidate report

Design a data structure that supports the insertion, deletion, and lookup of elements in average O(1) time complexity. Additionally, implement a method that returns a uniformly random element from the current collection, ensuring that each element has an equal probability of being selected in O(1) time.

Context & Summary

Technical Round with questions on project and data structures

💻 Coding practice works best on desktop.
Code editors are too cramped on mobile screens.