嗨嗨嗨
Hello World
发表于
本文字数: 367 阅读时长 ≈ 1 分钟
本文字数: 367 阅读时长 ≈ 1 分钟
Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.
分布式
嗨嗨嗨
字节暑期实习面经
记录暑期实习字节跳动的面试经历
网络I/O
学习网络I/O模型
C/C++
记录c++一些基础知识和面试常考点
LeetCode 146.LRU缓存
设计并实现一个满足 LRU (最近最少使用) 缓存 约束的数据结构。
实现 LRUCache 类:
- LRUCache(int capacity) 以 正整数 作为容量 capacity 初始化 LRU 缓存
- int get(int key) 如果关键字 key 存在于缓存中,则返回关键字的值,否则返回 -1 。
- void put(int key, int value)如果关键字key 已经存在,则变更其数据值value ;如果不存在,则向缓存中插入该组key-value 。如果插入操作导致关键字数量超过capacity ,则应该 逐出 最久未使用的关键字。
函数 get 和 put 必须以 O(1) 的平均时间复杂度运行。


