Your Dashboard
Interview Coaching
Learn
System Design
ML System Design
Code
Behavioral
Salary Negotiation
Interview Guides
Leetcode 1168. Optimize Water Distribution in a Village
Given per-house well costs and candidate pipe connections with costs, choose wells and pipes to supply water to all houses at minimum total cost. Model this as a minimum spanning tree by adding a virtual source node connected to each house with an edge weight equal to its well cost, then solve with MST/Union-Find or Prim/Kruskal.
Asked at:
Amazon
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
Late November, 2024
Amazon
Mid-level
Optimize warehouse connections to distribution hubs. Given n warehouses with capacities, calculate the minimum total connection cost for all warehouses to the nearest available distribution hub, considering additional hubs placed at specific locations.
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.