Minimum Spanning Tree Problem Leetcode 1509