Given a connected undirected weighted graph with n nodes and edges [u, v, w], return the total weight of its maximum spanning tree (the spanning tree of largest total weight). Return -1 if the graph is not connected. The input is JSON {n, edges}.
Input: JSON {n, edges} with edges [u, v, w].
Output: Integer — the maximum spanning-tree weight, or -1.
Input: {"n":4,"edges":[[0,1,1],[1,2,2],[2,3,3],[0,3,4],[0,2,5]]}
Output: 11
Explanation: Heaviest tree edges sum to 11.Input: {"n":1,"edges":[]}
Output: 0
Explanation: Single node.Input: {"n":3,"edges":[[0,1,4],[1,2,2]]}
Output: 6
Explanation: Both edges form the tree.1<=n<=10^5connected