码迷,mamicode.com
首页 > 系统相关 > 详细

[LeetCode] LRU Cache 缓存器

时间:2015-06-19 07:50:56      阅读:247      评论:0      收藏:0      [点我收藏+]

标签:

 

Design and implement a data structure for Least Recently Used (LRU) 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 reached its capacity, it should invalidate the least recently used item before inserting a new item.

 

[LeetCode] LRU Cache 缓存器

标签:

原文地址:http://www.cnblogs.com/grandyang/p/4587511.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!