Skip to content

Commit

Permalink
Create 198. House Robber.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Cyberavater authored Sep 3, 2022
1 parent f33d1d2 commit 1d9ccde
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions 198. House Robber.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from typing import List

class Solution:
def rob(self, nums: List[int]) -> int:
pair: List[int] = [0, 0]
for i in nums:
pair.append(max(pair[0] + i, pair[1]))
pair = pair[1:]
return pair[1]

0 comments on commit 1d9ccde

Please sign in to comment.