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 68d542c commit 0c41ad3Copy full SHA for 0c41ad3
house-robber/kayden.py
@@ -0,0 +1,11 @@
1
+class Solution:
2
+ # 시간복잡도: O(N)
3
+ # 공간복잡도: O(1)
4
+ def rob(self, nums: List[int]) -> int:
5
+ one, two = 0, 0
6
+
7
+ for num in nums:
8
+ temp = max(two+num, one)
9
+ two, one = one, temp
10
11
+ return one
0 commit comments