Design a data structure that follows the Least Recently Used (LRU) cache constraint. Implement get and put in O(1) time.
LRUCache(2) β put(1,1) β put(2,2) β get(1)β1 β put(3,3) β get(2)β-1 (evicted) β get(3)β3
Unlock hints progressively β start gentle, go deeper only if needed.
Level 1: Gentle Nudge
A subtle direction
Level 2: Approach
The algorithm to use
Level 3: Detailed
Step-by-step guidance
to save progress and use AI features