LRU Cache
Hard📝 Description
Design and implement an LRU (Least Recently Used) cache
Input Format
Cache capacity followed by get/put operations
Output Format
Results of get operations
Constraints
1 ≤ capacity ≤ 1000 0 ≤ key ≤ 1000 0 ≤ value ≤ 1000 At most 10000 operations
🔍 Sample Input
2
put(1,1), put(2,2), get(1), put(3,3), get(2)
✅ Sample Output
1, -1
Code Editor
Please login to run and submit code.
Results
Suggested Solution
Shortcuts: Ctrl+Enter to submit, Ctrl+Shift+R to run