Skip to main content
Code Review

Return to Question

Commonmark migration
Source Link

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

get(key) - Get the value (will always be positive) of the key if the key exists in the cache, otherwise return -1.

put(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.

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

get(key) - Get the value (will always be positive) of the key if the key exists in the cache, otherwise return -1.

put(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.

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

get(key) - Get the value (will always be positive) of the key if the key exists in the cache, otherwise return -1.

put(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.

edited title
Link
Gilad
  • 5.4k
  • 5
  • 38
  • 64

LeetCode: LRU cache implementation C#

Tweeted twitter.com/StackCodeReview/status/918941957673684993
edited tags
Link
200_success
  • 145.4k
  • 22
  • 190
  • 478
added 353 characters in body; edited tags; edited title
Source Link
t3chb0t
  • 44.6k
  • 9
  • 84
  • 190
Loading
Source Link
Gilad
  • 5.4k
  • 5
  • 38
  • 64
Loading
lang-cs

AltStyle によって変換されたページ (->オリジナル) /