Merge branch 'master' of https://github.com/CyC2018/InterviewNotes
This commit is contained in:
commit
27fdb171e2
25
SUMMARY.md
25
SUMMARY.md
|
@ -27,10 +27,23 @@ This file used to generate gitbook catalogue.
|
|||
* [Java 虚拟机](/notes/Java 虚拟机.md)
|
||||
* [Java 并发](/notes/Java 并发.md)
|
||||
* [Java 容器](/notes/Java 容器.md)
|
||||
* [Java I/O](/notes/Java I/O.md)
|
||||
* 分布式
|
||||
* [一致性](/notes/一致性.md)
|
||||
* [分布式问题分析](/notes/分布式问题分析.md)
|
||||
|
||||
|
||||
* [Java I/O](/notes/Java IO.md)
|
||||
* 系统设计
|
||||
* [系统设计基础](/notes/系统设计基础.md)
|
||||
* [分布式](/notes/分布式.md)
|
||||
* [集群](/notes/集群.md)
|
||||
* [攻击技术](/notes/攻击技术.md)
|
||||
* [缓存](/notes/缓存.md)
|
||||
* [消息队列](/notes/消息队列.md)
|
||||
* 工具
|
||||
* [Git](/notes/Git.md)
|
||||
* [Docker](/notes/Docker.md)
|
||||
* [正则表达式](/notes/正则表达式.md)
|
||||
* [构建工具](/notes/构建工具.md)
|
||||
* 编码实践
|
||||
* [重构](/notes/重构.md)
|
||||
* [代码可读性](/notes/代码可读性.md)
|
||||
* [代码风格规范](/notes/代码风格规范.md)
|
||||
* 参考书目
|
||||
* [BOOKLIST](/BOOKLIST.md)
|
||||
|
||||
|
|
|
@ -2415,8 +2415,7 @@ public int climbStairs(int n) {
|
|||
定义 dp 数组用来存储最大的抢劫量,其中 dp[i] 表示抢到第 i 个住户时的最大抢劫量。
|
||||
|
||||
由于不能抢劫邻近住户,因此如果抢劫了第 i 个住户那么只能抢劫 i - 2 或者 i - 3 的住户,所以
|
||||
|
||||
<div align="center"><img src="https://latex.codecogs.com/gif.latex?dp[i]=max(dp[i-2],dp[i-3])+nums[i]"/></div> <br>
|
||||
dp[i] = max(dp[i-1], dp[i-2] + nums[i]) <br>
|
||||
|
||||
```java
|
||||
public int rob(int[] nums) {
|
||||
|
@ -2428,6 +2427,7 @@ public int rob(int[] nums) {
|
|||
}
|
||||
return pre1;
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
**强盗在环形街区抢劫**
|
||||
|
@ -2505,9 +2505,9 @@ public int minPathSum(int[][] grid) {
|
|||
for (int i = 0; i < m; i++) {
|
||||
for (int j = 0; j < n; j++) {
|
||||
if (i == 0) {
|
||||
dp[j] = dp[j - 1];
|
||||
if (j>0) dp[j] = dp[j - 1];
|
||||
} else {
|
||||
dp[j] = Math.min(dp[j - 1], dp[j]);
|
||||
if (j>0) dp[j] = Math.min(dp[j - 1], dp[j]);
|
||||
}
|
||||
dp[j] += grid[i][j];
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user