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.
Top comments (0)