Update Leetcode 题解 - 动态规划.md

代码缩进
This commit is contained in:
quyan 2019-04-29 11:06:59 +08:00 committed by GitHub
parent 0cd4e69494
commit 4f652fd8d9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -110,7 +110,7 @@ public int rob(int[] nums) {
[213. House Robber II (Medium)](https://leetcode.com/problems/house-robber-ii/description/)
```java
public int rob(int[] nums) {
public int rob(int[] nums) {
if (nums == null || nums.length == 0) {
return 0;
}
@ -121,7 +121,7 @@ public int rob(int[] nums) {
return Math.max(rob(nums, 0, n - 2), rob(nums, 1, n - 1));
}
private int rob(int[] nums, int first, int last) {
private int rob(int[] nums, int first, int last) {
int pre2 = 0, pre1 = 0;
for (int i = first; i <= last; i++) {
int cur = Math.max(pre1, pre2 + nums[i]);