Back to course home
0% completed
Optimize Water Distribution in a Village (hard)
Problem Statement
There is a village with n
houses connected by pipes. You need to ensure that each house will get a water supply.
For each house i
, you can either dig a well inside it with cost wells[i - 1]
or get water via a pipe from another well to it. The costs to get water via pipes between houses are given by the array pipes
where each pipes[j] = [house1<sub>j</sub>, house2<sub>j</sub>, cost<sub>j</sub>] represents the cost to connect house1<sub>j</sub> and house2<sub>j</sub> together using a pipe. Here, pipe connection is bidirectonal.
Return the minimum
total `cost
.....
.....
.....
Like the course? Get enrolled and start learning!
Table of Contents
Contents are not accessible
Contents are not accessible
Contents are not accessible
Contents are not accessible
Contents are not accessible