双向链表
文章平均质量分 74
memcpy0
希望探索文理结合的自由之路。
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
LeetCode C++ 面试题 16.25. LRU Cache LCCI【设计/哈希表/链表】中等
Design and build a “least recently used” cache, which evicts the least recently used item. The cache should map from keys to values (allowing you to insert and retrieve a value associated with a particular key) and be initialized with a max size. When it原创 2021-04-13 19:36:24 · 459 阅读 · 0 评论 -
LeetCode C++ 剑指 Offer 62. 圆圈中最后剩下的数字【Linked List/Math】简单
0,1,n-1这n个数字排成一个圆圈,从数字0开始,每次从这个圆圈里删除第m个数字。求出这个圆圈里剩下的最后一个数字。例如,0、1、2、3、4这5个数字组成一个圆圈,从数字0开始每次删除第3个数字,则删除的前4个数字依次是2、0、4、1,因此最后剩下的数字是3。示例 1:输入: n = 5, m = 3输出: 3示例 2:输入: n = 10, m = 17输出: 2限制:1 <= n <= 10^51 <= m <= 10^6解法 规律class原创 2020-12-26 01:15:18 · 433 阅读 · 0 评论 -
LeetCode C++ 460. LFU Cache【Design/Hash Table/Double LinkedList】困难
Design and implement a data structure for Least Frequently Used (LFU) cache .Implement the LFUCache class:LFUCache(int capacity) Initializes the object with the capacity of the data structure.int get(int key) Gets the value of the key if the key exists原创 2020-10-23 16:11:12 · 540 阅读 · 0 评论 -
LeetCode 146. LRU Cache【设计,哈希表,双向链表】中等
Design a data structure that follows the constraints of a Least Recently Used (LRU) cache .Implement the LRUCache class:LRUCache(int capacity) Initialize the LRU cache with positive size capacity .int get(int key) Return the value of the key if the key原创 2020-10-20 22:41:34 · 597 阅读 · 1 评论
分享