Tag: LRU

  • LeetCode: 146 LRU Cache

    Design a data structure that follows the constraints of a Least Recently Used (LRU) cache. Implement the LRUCache class: LRUCache(int capacity) initializes the LRU cache with positive size capacity. int get(int key) returns the value of the key if the key exists in the cache, otherwise returns -1. void put(int…