File tree Expand file tree Collapse file tree 2 files changed +27
-8
lines changed
Expand file tree Collapse file tree 2 files changed +27
-8
lines changed Original file line number Diff line number Diff line change 11---
22title : 213.Hiccup II
3- date : ' 2024.01.01 0:00'
3+ date : " 2024.01.01 0:00"
44tags :
55 - Python
66 - answer
77 - Array
88 - Dynamic planning
99abbrlink : 85beb0bf
10+ docId : rv6egbynttb4mt1n0412bue0
1011---
11- # topic:
1212
13+ # topic:
1314
1415[ topic链接] ( https://leetcode-cn.com/problems/house-robber-ii/ )
1516
1617# Thought:
18+
1719这一次终于懂一点Dynamic planning了,The first is the youngest problem,I first thought it was to consider where to start,Start from the first or the second one(这刚好是和Hiccup1Difference)。
1820但实际上最小子问题还是和Hiccup1Same:Whether to rob the current house。
1921First we set one` dp ` Array,` dp[i] ` Indicate robbery to the first` i ` The maximum return when a house。
@@ -39,4 +41,4 @@ class Solution:
3941 return ans
4042 # 打劫First一家,或者First二家开始
4143 return max (rob1(nums[:- 1 ]), rob1(nums[1 :])) if len (nums) != 1 else nums[0 ]
42- ```
44+ ```
Original file line number Diff line number Diff line change 11{
22 "repo" : " InvolutionHell/involutionhell" ,
3- "generatedAt" : " 2025-11-13T03:06:20.335Z " ,
3+ "generatedAt" : " 2025-11-14T03:05:54.670Z " ,
44 "docsDir" : " app/docs" ,
5- "totalDocs" : 111 ,
5+ "totalDocs" : 112 ,
66 "results" : [
77 {
88 "docId" : " ue27z7z95yzw3lhhfj7nit1c" ,
20172017 }
20182018 ]
20192019 },
2020+ {
2021+ "docId" : " rv6egbynttb4mt1n0412bue0" ,
2022+ "path" : " app/docs/CommunityShare/Leetcode/[213]打家劫舍 II_translated.md" ,
2023+ "contributorStats" : {
2024+ "114939201" : 1
2025+ },
2026+ "contributors" : [
2027+ {
2028+ "githubId" : " 114939201" ,
2029+ "contributions" : 1 ,
2030+ "lastContributedAt" : " 2025-11-14T03:00:17.000Z" ,
2031+ "login" : " longsizhuo" ,
2032+ "avatarUrl" : " https://avatars.githubusercontent.com/u/114939201?v=4" ,
2033+ "htmlUrl" : " https://github.com/longsizhuo"
2034+ }
2035+ ]
2036+ },
20202037 {
20212038 "docId" : " p8igr19xfxnuyo2lpngnr6fg" ,
20222039 "path" : " app/docs/CommunityShare/Leetcode/1234. 替换子串得到平衡字符串_translated.md" ,
20552072 "docId" : " a6inw303oslb7i5tcqj5xxx4" ,
20562073 "path" : " app/docs/CommunityShare/Leetcode/2270. Number of Ways to Split Array.md" ,
20572074 "contributorStats" : {
2058- "114939201" : 1
2075+ "114939201" : 2
20592076 },
20602077 "contributors" : [
20612078 {
20622079 "githubId" : " 114939201" ,
2063- "contributions" : 1 ,
2064- "lastContributedAt" : " 2025-11-13T03:00:08 .000Z" ,
2080+ "contributions" : 2 ,
2081+ "lastContributedAt" : " 2025-11-13T03:06:21 .000Z" ,
20652082 "login" : " longsizhuo" ,
20662083 "avatarUrl" : " https://avatars.githubusercontent.com/u/114939201?v=4" ,
20672084 "htmlUrl" : " https://github.com/longsizhuo"
You can’t perform that action at this time.
0 commit comments