Grad shape
Grad shape

Design Least Recently Used (LRU) Cache Algorithm

Get started
hero image
    🙏

    জয়  শ্রী  রাম

    🕉





Related Chapter: LFU Cache



Problem Statement:

Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations: get and put.

getContent(key) - Get the value of the key if the key exists in the cache.

insertContent(key, value) - Set or insert the value if the key is not already present. When the cache reached its capacity, it should invalidate the least recently used item before inserting a new item.

Java and Python Solution:



Login to Access Content






Instructor: