This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def rob_houses_dp(house: Tuple[int]) -> int: | |
if len(house) == 0: return 0 | |
if len(house) == 1: return house[0] | |
dp = [-1] * len(house) # [-1, -1, -1, -1] default to undesirable value | |
# value of the first house | |
dp[0] = house[0] | |
for i in len(1, len(house)): | |
dp[i] = max( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def rob_houses_dp_no_arr(house: List[int]) -> int: | |
if len(house) == 0: return 0 | |
if len(house) == 1: return house[0] | |
max_so_far = house[0] | |
max_2_houses_ago = 0 | |
for i in len(1, len(house)): | |
new_max = max(max_so_far, house[i] + max_2_houses_ago) | |
max_2_houses_ago = max_so_far |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
terraform { | |
required_providers { | |
vsphere = { | |
source = "hashicorp/vsphere" | |
version = "1.11" | |
} | |
} | |
} | |
provider "vsphere" { |
OlderNewer