Given a connected, weighted, undirected graph with n nodes (labeled 0 to n-1) and a list of edges [u, v, weight], return the total weight of the Minimum Spanning Tree.
Example 1:
Input: n=4, edges=[[0,1,1],[0,2,4],[1,2,2],[1,3,5],[2,3,1]] Output: 4 (edges: 0-1 wt1, 2-3 wt1, 1-2 wt2)
Example 2:
Input: n=3, edges=[[0,1,3],[0,2,1],[1,2,2]] Output: 3
Constraints:
- 2 <= n <= 1000
- edges.length >= n-1