Leetcode Minimum Spanning Tree Example