Skip to content

Commit 26343df

Browse files
committed
docs(algorithms, dynamic-programming): update readme
1 parent 28a2794 commit 26343df

File tree

1 file changed

+3
-3
lines changed
  • algorithms/dynamic_programming/painthouse

1 file changed

+3
-3
lines changed

algorithms/dynamic_programming/painthouse/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,15 @@ min(prev_min_cost_red, prev_min_cost_green) + cost_blue, min(prev_min_cost_red,
7272

7373
Breaking this down:
7474

75-
- New `prev_min_cost_red` (cost if current house is red): `min(prev_min_cost_blue, prev_min_cost_gree) + cost_red`
75+
- New `prev_min_cost_red` (cost if current house is red): `min(prev_min_cost_blue, prev_min_cost_green) + cost_red`
7676
We take the minimum of the previous costs where the house was NOT red (either blue or green)
7777
Add the cost of painting the current house red
7878

7979
- New `prev_min_cost_blue` (cost if current house is blue): `min(prev_min_cost_red, prev_min_cost_green) + cost_blue`
8080
We take the minimum of the previous costs where the house was NOT blue (either red or green)
8181
Add the cost of painting the current house blue
8282

83-
- New `prev_min_cost_green` (cost if current house is green): `min(prev_min_cost_red, prev_min_cost_blue) + cost_blue`
83+
- New `prev_min_cost_green` (cost if current house is green): `min(prev_min_cost_red, prev_min_cost_blue) + cost_green`
8484
We take the minimum of the previous costs where the house was NOT green (either red or blue)
8585
Add the cost of painting the current house green
8686

@@ -90,7 +90,7 @@ Final Result: After processing all houses, `prev_min_cost_red`, `prev_min_cost_b
9090
the minimum costs to paint all houses with the last house being red, blue, or green respectively. The answer is the
9191
minimum among these three values:
9292

93-
`return min(prev_mins_cost_red, prev_min_cost_blue, prev_min_cost_green)`
93+
`return min(prev_min_cost_red, prev_min_cost_blue, prev_min_cost_green)`
9494

9595
### Complexity Analysis
9696

0 commit comments

Comments
 (0)