Product
Pricing
Blog
Forum
NEW
Referral
Description
Solution
Discussion
Submissions
Ask AI
AI Insights
Quick Summary
Design a fixed-capacity cache that stores key-value pairs alongside integer priority ranks.
Return cached values on hits, fetch from a slow data source on misses, and evict the lowest-ranked entry when at capacity.
Handle rank ties by allowing the removal of any minimum-rank item.
What This Tests
Data structure composition and trade-offs
Efficient lookup and minimum-tracking mechanisms
Cache eviction logic and state synchronization
Interface-driven design and abstraction
Common Patterns
Hashing
Collapse
Hint 1
Hint 2
Hint 3
What Interviewers May Ask Next
Report
Report seen similar question in interview
Ask AI Assistant
Ask AI Assistant
Ask me anything about this coding question!
python
Auto
Debug
Run
Submit
Stdout
-