CppBuzz.com
  
Home C C++ Java Python Perl PHP SQL JavaScript Linux Online Test Forum

Home » Forum » x-Forum » Question

LRU Cache proglem

Hi,

Can someone pls help in solving the LRU Cache problem.

Problem URL - https://www.interviewbit.com/problems/lru-cache/

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

get(key) - Get the value (will always be positive) of the key if the key exists in the cache, otherwise return -1.
set(key, value) - Set or insert the value if the key is not already present. When the cache reaches its capacity, it should invalidate the least recently used item before inserting the new item.
The LRU Cache will be initialized with an integer corresponding to its capacity. Capacity indicates the maximum number of unique keys it can hold at a time.

Posted by myralyons 2018-10-29 01:04:50

No Ans Posted

Your Answer


Ask New Question