Min Spanning Tree Leetcode Question