Connect all offices with network cable at the lowest total cost. That's a minimum spanning tree. Kruskal's algorithm: sort edges by weight, then add each edge unless it would form a cycle, checked with union-find.
Unlock this and every premium problem across all tracks — plus hidden-test grading, advanced AI engineering modules and new content every week.
Start 7-day free trial