Implement a class LRUCache(capacity) with O(1) get(key) (returns -1 if missing) and put(key, value). When full, put evicts the least recently used key. Both get and put count as a "use".
Unlock this and every premium problem across all tracks — plus hidden-test grading, advanced AI engineering modules and new content every week.
Start 7-day free trial