Skip to content

Commit 39d2336

Browse files
authored
Update house-robber.py
1 parent 77df741 commit 39d2336

File tree

1 file changed

+1
-15
lines changed

1 file changed

+1
-15
lines changed

Python/house-robber.py

+1-15
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,7 @@
44
class Solution(object):
55
# @param num, a list of integer
66
# @return an integer
7-
def rob(self, num):
8-
if len(num) == 0:
9-
return 0
10-
11-
if len(num) == 1:
12-
return num[0]
13-
14-
num_i, num_i_1 = max(num[1], num[0]), num[0]
15-
for i in xrange(2, len(num)):
16-
num_i_1, num_i_2 = num_i, num_i_1
17-
num_i = max(num[i] + num_i_2, num_i_1)
18-
19-
return num_i
20-
21-
def rob2(self, nums):
7+
def rob(self, nums):
228
"""
239
:type nums: List[int]
2410
:rtype: int

0 commit comments

Comments
 (0)