DEV Community

Cover image for How to design LRU cache?
Roman Glushko
Roman Glushko

Posted on

How to design LRU cache?

This is, by the way, not a random question, but a popular coding interview challenge and an interesting problem by itself which made me write a whole blog post:

https://www.romaglushko.com/blog/design-lru-cache/ ⬅️

TLDR: you need to design a kind of custom data structure in order to make the cache storage to work in constant time which actually makes it practically useful. So be sure to check out the whole walkthrough above.

Discussion (0)