
Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
Connect each pair of points with a weighted edge, the weight being the manhattan distance between those points.
The problem is now the cost of minimum spanning tree in graph with above edges.