Back to Question

Implement an All $O(1)$ Data Structure

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

Click "Start Speaking" and answer the question naturally.