Skip to content

Commit

Permalink
feat: problem 198
Browse files Browse the repository at this point in the history
  • Loading branch information
ashwin-nair98 committed Jan 21, 2024
1 parent 020f830 commit df98e05
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions 198_House Robber/Solution.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
class Solution:
def rob(self, nums: List[int]) -> int:
prev, curr = 0, 0
for i in nums:
temp = max(prev + i, curr)
prev = curr
curr = temp
return curr

0 comments on commit df98e05

Please sign in to comment.