We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a9593e8 commit 3c2f0b0Copy full SHA for 3c2f0b0
house-robber/jeongyunjae.py
@@ -0,0 +1,18 @@
1
+class Solution:
2
+ def rob(self, nums: List[int]) -> int:
3
+ result = list(nums)
4
+
5
+ for i, data in enumerate(result):
6
+ if i <= 1:
7
+ continue
8
9
+ stolen_money = result[i]
10
+ before_house_money = result[i-1]
11
12
+ for j in range(i-1):
13
+ if result[i] + result[j] > stolen_money:
14
+ stolen_money = result[i] + result[j]
15
16
+ result[i] = max(before_house_money, stolen_money)
17
18
+ return max(result)
0 commit comments