⚡️ Tryprepforge
Backend Engineering Senior programming

LeetCode #146 - LRU Cache\nDesign and implement a data structure that allows you to add key-value pairs and retrieve the value of a given key. If the key does not exist, return -1. If the cache reaches its capacity, it should invalidate the least recently used item before inserting a new item.\nInput: An integer capacity and a list of operations in the format ['put(key, value)', 'get(key)', ...]\nOutput: Return the result of get operations in order.\nConstraints: 1 <= capacity <= 3000 and all keys are unique.

Suggested Answer

Practice More Questions Like This

Generate unlimited interview questions with structured answers, code formatting, and immersive audio explanations.

No credit card required

More Backend Engineering Interview Prep

Link copied to clipboard