原题:
"""
This is a typical minimum spanning tree question, it can be solved using either Kruskal or Prim's algorithm
Below is a Prim's algorithm implementation
Here is a wiki for Pirm's algorithm https://en.wikipedia.org/wiki/Prim's_algorithm
Time Complexity: Prim's Algorithm takes O(NlgN) but the whole solution is dominated by O(N*N) due to graph creation (nested loop)
You are given an array points representing integer coordinates of some points on a 2D-plane, where points[i] = [xi, yi].
The cost of connecting two points [xi, yi] and [xj, yj] is the manhattan distance between them: |xi - xj| + |yi - yj|, where |val| denotes the absolute value of val.
Return the minimum cost to make all points connected. All points are connected if there is exactly one simple path between any two points.
Input: points = [[3,12],[-2,5],[-4,1]]
Output: 18
"""