forked from wisdompeak/LeetCode
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d3ed9d8
commit 44d95c2
Showing
1 changed file
with
3 additions
and
0 deletions.
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
Union_Find/1168.Optimize-Water-Distribution-in-a-Village/Readme.md
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
### 1168.Optimize-Water-Distribution-in-a-Village | ||
|
||
此题的解法非常巧妙。你增加一个隐藏的0号节点,把每个节点自建井的费用wells[i]想象成连接[0,i]的边的费用。这样,这道题就变成了求最少的费用将所有的节点(包括隐藏的0号)连接起来。这就是最基本的最小生成树问题(MST),和```1135.Connecting-Cities-With-Minimum-Cost```一模一样。 |