Skip to content

Commit a7191a8

Browse files
waningflowazl397985856
authored andcommitted
fix: add some notes in 198.house-robber.md (#117)
* Update 198.house-robber.md * Update 198.house-robber.md
1 parent 5a4113b commit a7191a8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

problems/198.house-robber.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ Explanation: Rob house 1 (money = 2), rob house 3 (money = 9) and rob house 5 (m
4242

4343
> 这里的 dp 其实就是`子问题`.
4444
45-
状态转移方程也不难写`dp[i] = Math.max(dp[i - 2] + nums[i - 2], dp[i - 1]);`.
45+
状态转移方程也不难写`dp[i] = Math.max(dp[i - 2] + nums[i - 2], dp[i - 1]);`(注:这里为了方便计算,令 `dp[0]``dp[1]`都等于 0,所以 `dp[i]`对应的是 `nums[i - 2]`
4646

4747
上述过程用图来表示的话,是这样的:
4848

0 commit comments

Comments
 (0)