Skip to content

Commit c0ae760

Browse files
committed
在2家的情况应该用max
1 parent 0e99748 commit c0ae760

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

house_robber.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def houseRobber(self, A):
1515
if len(A) == 1:
1616
return A[0]
1717
if len(A) == 2:
18-
return min(A[0], A[1])
18+
return max(A[0], A[1])
1919
for i in xrange(2, len(A)):
2020
A[i] = max(A[i] + A[i - 2], A[i - 1])
2121
return A[-1]

0 commit comments

Comments
 (0)