Leetcode Minimum Spanning Tree Prims Algorithm