Problem LeetCode 146. LRU Cache ↗ · NeetCode LRU Cache ↗ · LeetCode 460. LFU Cache ↗ · NeetCode LFU Cache ↗· The solutions on this page are my own.

LRU & LFU Cache Visualizer

How SimpleLRUCache and SimpleLFUCache decide which key to throw out. Every example uses a capacity of 3.

    just used just added evicted

    lines that run are highlighted