You are given an array of n distinct points on the plane, where points[i] = [xi, yi]. Connect all points with minimum total cost. The cost of connecting two points is the Manhattan distance between them, |xi - xj| + |yi - yj|. Return the minimum total cost of a connected network that joins all points. A network uses edges between pairs of input positions, and no edge may be used more than once.
For these bounds, the answer is at most 192,000,000. Let s = ceil(sqrt(n)) <= 32, let Lx = xmax - xmin and Ly = ymax - ymin, and partition the x-range into s strips of actual width w = Lx/s (empty strips may be skipped). Order points by y within each nonempty strip, alternating direction between strips. The combined horizontal length is at most w(n+s-2) <= Lx(s+1), because n <= s^2; the vertical length is at most (2s-1)Ly. With Lx,Ly <= 2,000,000, this is at most 2,000,000*33 + 63*2,000,000 = 192,000,000. The MST is no heavier than this spanning tree, so the returned total fits the signed 32-bit range used by the implementations.