Back to Questions

Implement an All $O(1)$ Data Structure

77.8K viewsAsked at Stripe
Hard

Question Explain

Design a data structure that supports the following operations in $O(1)$ time: `inc(key)`, `dec(key)`, `getMaxKey()`, and `getMinKey()`. This requires linking multiple Doubly Linked Lists and Hash Maps.

Start Trying This Question Simulation

Practice answering orally or with text to get instant AI feedback.

Practice with This Question
Implement an All $O(1)$ Data Structure - Interview Question