diff --git a/Additional.md b/Additional.md index 9ed7bb4b..d4a23bdd 100644 --- a/Additional.md +++ b/Additional.md @@ -22,6 +22,8 @@ - [[微服务学习资料汇总][知识点]](https://www.infoq.cn/article/2014%2F07%2Fmicroservice-learning-resources) - [[理解 RESTful 架构][知识点]](http://www.ruanyifeng.com/blog/2011/09/restful.html) - [[MapReduce 算法][知识点]](https://github.com/xuelangZF/CS_Offer/blob/master/Others/Hadoop_Spark.md) +- [[高并发、分布式、高可用][面试题集锦]](https://github.com/doocs/advanced-java) + # Spring diff --git a/README.md b/README.md index 495e0843..3ed707a9 100644 --- a/README.md +++ b/README.md @@ -12,151 +12,151 @@ ### :pencil2: 算法 -- [剑指 Offer 题解](https://github.com/CyC2018/InnterviewNotes/blob/master/notes/剑指%20offer%20题解.md) +- [剑指 Offer 题解](/notes/剑指%20offer%20题解.md) 目录根据原书第二版进行编排,代码和原书有所不同,尽量比原书更简洁。 -- [Leetcode 题解](https://github.com/CyC2018/InnterviewNotes/blob/master/notes/Leetcode%20题解.md) +- [Leetcode 题解](/notes/Leetcode%20题解.md) 对题目做了一个大致分类,并对每种题型的解题思路做了总结。 - - [算法](https://github.com/CyC2018/InnterviewNotes/blob/master/notes/算法.md) + - [算法](/notes/算法.md) 排序、并查集、栈和队列、红黑树、散列表。 ### :computer: 操作系统 -- [计算机操作系统](https://github.com/CyC2018/InnterviewNotes/blob/master/notes/计算机操作系统.md) +- [计算机操作系统](/notes/计算机操作系统.md) 进程管理、内存管理、设备管理、链接。 -- [Linux](https://github.com/CyC2018/InnterviewNotes/blob/master/notes/Linux.md) +- [Linux](/notes/Linux.md) 基本实现原理以及基本操作。 ### :cloud: 网络 -- [计算机网络](https://github.com/CyC2018/InnterviewNotes/blob/master/notes/计算机网络.md) +- [计算机网络](/notes/计算机网络.md) 物理层、链路层、网络层、运输层、应用层。 -- [HTTP](https://github.com/CyC2018/InnterviewNotes/blob/master/notes/HTTP.md) +- [HTTP](/notes/HTTP.md) 方法、状态码、Cookie、缓存、连接管理、HTTPs、HTTP 2.0。 -- [Socket](https://github.com/CyC2018/InnterviewNotes/blob/master/notes/Socket.md) +- [Socket](/notes/Socket.md) I/O 模型、I/O 多路复用。 ### :couple: 面向对象 -- [设计模式](https://github.com/CyC2018/InnterviewNotes/blob/master/notes/设计模式.md) +- [设计模式](/notes/设计模式.md) 实现了 Gof 的 23 种设计模式。 -- [面向对象思想](https://github.com/CyC2018/InnterviewNotes/blob/master/notes/面向对象思想.md) +- [面向对象思想](/notes/面向对象思想.md) 三大原则(继承、封装、多态)、类图、设计原则。 ### :floppy_disk: 数据库 -- [数据库系统原理](https://github.com/CyC2018/InnterviewNotes/blob/master/notes/数据库系统原理.md) +- [数据库系统原理](/notes/数据库系统原理.md) 事务、锁、隔离级别、MVCC、间隙锁、范式。 -- [SQL](https://github.com/CyC2018/InnterviewNotes/blob/master/notes/SQL.md) +- [SQL](/notes/SQL.md) SQL 基本语法。 -- [Leetcode-Database 题解](https://github.com/CyC2018/InnterviewNotes/blob/master/notes/Leetcode-Database%20题解.md) +- [Leetcode-Database 题解](/notes/Leetcode-Database%20题解.md) Leetcode 上数据库题目的解题记录。 -- [MySQL](https://github.com/CyC2018/InnterviewNotes/blob/master/notes/MySQL.md) +- [MySQL](/notes/MySQL.md) 存储引擎、索引、查询优化、切分、复制。 -- [Redis](https://github.com/CyC2018/InnterviewNotes/blob/master/notes/Redis.md) +- [Redis](/notes/Redis.md) 五种数据类型、字典和跳跃表数据结构、使用场景、和 Memcache 的比较、淘汰策略、持久化、文件事件的 Reactor 模式、复制。 ### :coffee: Java -- [Java 基础](https://github.com/CyC2018/InnterviewNotes/blob/master/notes/Java%20基础.md) +- [Java 基础](/notes/Java%20基础.md) 不会涉及很多基本语法介绍,主要是一些实现原理以及关键特性。 -- [Java 容器](https://github.com/CyC2018/InnterviewNotes/blob/master/notes/Java%20容器.md) +- [Java 容器](/notes/Java%20容器.md) 源码分析:ArrayList、Vector、CopyOnWriteArrayList、LinkedList、HashMap、ConcurrentHashMap、LinkedHashMap、WeakHashMap。 -- [Java 并发](https://github.com/CyC2018/InnterviewNotes/blob/master/notes/Java%20并发.md) +- [Java 并发](/notes/Java%20并发.md) 线程使用方式、两种互斥同步方法、线程协作、JUC、线程安全、内存模型、锁优化。 -- [Java 虚拟机](https://github.com/CyC2018/InnterviewNotes/blob/master/notes/Java%20虚拟机.md) +- [Java 虚拟机](/notes/Java%20虚拟机.md) 运行时数据区域、垃圾收集、类加载。 -- [Java I/O](https://github.com/CyC2018/InnterviewNotes/blob/master/notes/Java%20IO.md) +- [Java I/O](/notes/Java%20IO.md) NIO 的原理以及实例。 ### :bulb: 系统设计 -- [系统设计基础](https://github.com/CyC2018/InnterviewNotes/blob/master/notes/系统设计基础.md) +- [系统设计基础](/notes/系统设计基础.md) 性能、伸缩性、扩展性、可用性、安全性 -- [分布式](https://github.com/CyC2018/InnterviewNotes/blob/master/notes/分布式.md) +- [分布式](/notes/分布式.md) 分布式锁、分布式事务、CAP、BASE、Paxos、Raft -- [集群](https://github.com/CyC2018/InnterviewNotes/blob/master/notes/集群.md) +- [集群](/notes/集群.md) 负载均衡、Session 管理 -- [攻击技术](https://github.com/CyC2018/InnterviewNotes/blob/master/notes/攻击技术.md) +- [攻击技术](/notes/攻击技术.md) XSS、CSRF、SQL 注入、DDoS -- [缓存](https://github.com/CyC2018/InnterviewNotes/blob/master/notes/缓存.md) +- [缓存](/notes/缓存.md) 缓存特征、缓存位置、缓存问题、数据分布、一致性哈希、LRU、CDN -- [消息队列](https://github.com/CyC2018/InnterviewNotes/blob/master/notes/消息队列.md) +- [消息队列](/notes/消息队列.md) 消息处理模型、使用场景、可靠性 ### :hammer: 工具 -- [Git](https://github.com/CyC2018/InnterviewNotes/blob/master/notes/Git.md) +- [Git](/notes/Git.md) 一些 Git 的使用和概念。 -- [Docker](https://github.com/CyC2018/InnterviewNotes/blob/master/notes/Docker.md) +- [Docker](/notes/Docker.md) Docker 基本原理。 -- [正则表达式](https://github.com/CyC2018/InnterviewNotes/blob/master/notes/正则表达式.md) +- [正则表达式](/notes/正则表达式.md) 正则表达式基本语法。 -- [构建工具](https://github.com/CyC2018/InnterviewNotes/blob/master/notes/构建工具.md) +- [构建工具](/notes/构建工具.md) 构建工具的基本概念、主流构建工具介绍。 ### :speak_no_evil: 编码实践 -- [重构](https://github.com/CyC2018/InnterviewNotes/blob/master/notes/重构.md) +- [重构](/notes/重构.md) 参考 重构 改善既有代码的设计。 -- [代码可读性](https://github.com/CyC2018/InnterviewNotes/blob/master/notes/代码可读性.md) +- [代码可读性](/notes/代码可读性.md) 参考 编写可读代码的艺术。 -- [代码风格规范](https://github.com/CyC2018/InnterviewNotes/blob/master/notes/代码风格规范.md) +- [代码风格规范](/notes/代码风格规范.md) Google 开源项目的代码风格规范。 @@ -178,7 +178,7 @@ #### BookList -本仓库参考的书目:[BOOKLIST](https://github.com/CyC2018/Interview-Notebook/blob/master/BOOKLIST.md)。 +本仓库参考的书目:[BOOKLIST](/BOOKLIST.md)。 #### Typesetting @@ -232,6 +232,9 @@ Power by [logomakr](https://logomakr.com/). + +​ + #### License diff --git a/notes/剑指 offer 题解.md b/notes/剑指 offer 题解.md index fbd0f07a..34c928a3 100644 --- a/notes/剑指 offer 题解.md +++ b/notes/剑指 offer 题解.md @@ -90,7 +90,7 @@ # 2. 实现 Singleton -[单例模式](https://github.com/CyC2018/Interview-Notebook/blob/master/notes/%E8%AE%BE%E8%AE%A1%E6%A8%A1%E5%BC%8F.md) +[单例模式](/notes/%E8%AE%BE%E8%AE%A1%E6%A8%A1%E5%BC%8F.md) # 3. 数组中重复的数字 @@ -558,7 +558,7 @@ public int JumpFloor(int n) { ## 题目描述 -我们可以用 2\*1 的小矩形横着或者竖着去覆盖更大的矩形。请问用 n 个 2\*1 的小矩形无重叠地覆盖一个 2\*n 的大矩形,总共有多少种方法? +我们可以用 `2*1` 的小矩形横着或者竖着去覆盖更大的矩形。请问用 n 个 `2*1` 的小矩形无重叠地覆盖一个 `2*n` 的大矩形,总共有多少种方法? ## 解题思路 @@ -598,6 +598,32 @@ public int JumpFloorII(int target) { } ``` +另一种方法是通过数学式子推导。 + +跳上 `n-1` 级台阶,可以从 `n-2` 级跳 `1` 级上去,也可以从 `n-3` 级跳 `2` 级上去...也可以从 `0` 级跳上去。那么 +``` +f(n-1) = f(0) + f(1) + ... + f(n-2) ① +``` + +跳上 `n` 级台阶,可以从 `n-1` 级跳 `1` 级上去,也可以从 `n-2` 级跳 `2` 级上去...也可以从 `0` 级跳上去。那么 +``` +f(n) = f(0) + f(1) + ... + f(n-2) + f(n-1) ② + +②-①: +f(n) - f(n-1) = f(n-1) +f(n) = 2f(n-1) +``` + +所以 f(n) 是一个等比数列: +``` +f(n) = 2^(n-1) +``` + +```java +public int JumpFloorII(int target) { + return (int) Math.pow(2, target - 1); +} +``` # 11. 旋转数组的最小数字