LC: 1168. Optimize Water Distribution in a Village
Input: n = 3, wells = [1,2,2], pipes = [[1,2,1],[2,3,1]]
Output: 3
Explanation:
The image shows the costs of connecting houses using pipes.
The best strategy is to build a well in the first house with cost 1 and connect the other houses to it with cost 2 so the total cost is 3.Input: n = 2, wells = [1,1], pipes = [[1,2,1]]
Output: 2PreviousLC: 1167. Minimum Cost to Connect SticksNextLC: 1180. Count Substrings with Only One Distinct Letter
Last updated

