CodingReported in a candidate post, Jul 2020
Dictionary with O(1) random deletion
Filed under Affirm
The question
Create a dictionary with add, get, delete, and deleteRandom methods where deleteRandom removes a random value in O(1) time and each element has an equal probability of being returned.
No write-up yet. Related questions below have one.
Related Affirm questions
Collected from public candidate posts and coding forums. Updated Nov 2026.