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 8909bba commit b1313e3Copy full SHA for b1313e3
solution/0100-0199/0198.House Robber/Solution3.py
@@ -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