164. Min Cost to Connect All Points

Given an array of points points on a plane. Return the minimum total cost to connect all points, where the edge cost is the Manhattan distance (minimum spanning tree).
Example 1
Input: points = [[3,12],[-2,5],[-4,1]]
Output: 18
Explanation: Three points on a plane.
Example 2
Input: points = [[0,0],[2,2],[3,10],[5,2],[7,0]]
Output: 20
Explanation: MST by Manhattan distance.
graph
JavaScript
Loading...
Line 1, Char 1