Skip to content

Commit b1313e3

Browse files
authored
Create Solution3.py
1 parent 8909bba commit b1313e3

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+
f = g = 0
4+
for x in nums:
5+
f, g = max(f, g), f + x
6+
return max(f, g)

0 commit comments

Comments
 (0)