Skip to content

Commit db1fe28

Browse files
committed
Time: 0 ms (100%), Space: 18 MB (13.32%) - LeetHub
1 parent da0a377 commit db1fe28

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
class Solution:
2+
def rob(self, nums: List[int]) -> int:
3+
prev, curr = 0, 0
4+
for num in nums:
5+
prev, curr = curr, max(curr, prev + num)
6+
return curr

0 commit comments

Comments
 (0)