Skip to content

Commit 3cdb399

Browse files
authored
Merge pull request #643 from pickfire/patch-1
Remove temporary variable
2 parents 3064d2e + 7cdd417 commit 3cdb399

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

algorithms/dp/house_robber.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,5 @@
1515
def house_robber(houses):
1616
last, now = 0, 0
1717
for house in houses:
18-
tmp = now
19-
now = max(last + house, now)
20-
last = tmp
18+
last, now = now, max(last + house, now)
2119
return now

0 commit comments

Comments
 (0)