AlgoMaster Logo

1168. Optimize Water Distribution in a Village

n=3,wells=[1,2,2],pipes=[[1,2,1],[2,3,1]]
0 / 14
algomaster.io
Step:Optimize water distribution for 3 houses. Introduce a virtual "Well" node (0) and find the MST using Kruskal's algorithm.