Skip to content

Commit

Permalink
Merge pull request keon#643 from pickfire/patch-1
Browse files Browse the repository at this point in the history
Remove temporary variable
  • Loading branch information
ericklarac authored Mar 13, 2020
2 parents 3064d2e + 7cdd417 commit 3cdb399
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions algorithms/dp/house_robber.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,5 @@
def house_robber(houses):
last, now = 0, 0
for house in houses:
tmp = now
now = max(last + house, now)
last = tmp
last, now = now, max(last + house, now)
return now

0 comments on commit 3cdb399

Please sign in to comment.