[Golang] Union find solution by golang
Sort queries by limit\n2. Sort edges by distance\n3. For each query, Connect all the edges whose distances are less than limit by union find\n4. If queries[0] a
1. Sort queries by limit\n2. Sort edges by distance\n3. For each query, Connect all the edges whose distances are less than limit by union find\n4. If queries[0] and queries[1] meet the requirement, they should be in same group.\n```\nfunc DistanceLimitedPathsExist(n int, edgeList [][]int, queries [][]int) []bool {\n\tvar q_len int = len(queries)\n\tvar record []int = make([]int,q_len)\n\tfor i := 0;i < q_len;i++{\n\t\trecord[i] = i\n\t}\n\ttype funcType func (groups []int,node int)int\n\tvar get_parent funcType\n\tget_parent = func (groups []int,node int)int{\n\t\tif groups[node] != node{\n\t\t\tgroups[node] = get_parent(groups,groups[node])\n\t\t}\n\t\treturn groups[node]\n\t}\n\tsort.Slice(record, func(i, j int) bool {\n\t\treturn queries[record[i]][2] < queries[record[j]][2]\n\t})\n\tsort.Slice(edgeList, func(i, j int) bool {\n\t\treturn edgeList[i][2] < edgeList[j][2]\n\t})\n\tvar groups []int = make([]int,n)\n\tfor i := 0;i < n;i++{\n\t\tgroups[i] = i\n\t}\n\tvar res []bool = make([]bool,q_len)\n\tvar edge_idx int = 0\n\tvar edge_len int = len(edgeList)\n\tfor i := 0;i < q_len;i++{\n\t\tfor edge_idx < edge_len && edgeList[edge_idx][2] < queries[record[i]][2]{\n\t\t\tnode1 := edgeList[edge_idx][0]\n\t\t\tnode2 := edgeList[edge_idx][1]\n\t\t\tgroup1 := get_parent(groups,node1)\n\t\t\tgroup2 := get_parent(groups,node2)\n\t\t\tif group1 != group2{\n\t\t\t\tif group1 < group2{\n\t\t\t\t\tgroups[group2] = group1\n\t\t\t\t}else{\n\t\t\t\t\tgroups[group1] = group2\n\t\t\t\t}\n\t\t\t}\n\t\t\tedge_idx++\n\t\t}\n\t\tn1 := queries[record[i]][0]\n\t\tn2 := queries[record[i]][1]\n\t\tif get_parent(groups,n1) == get_parent(groups,n2){\n\t\t\tres[record[i]] = true\n\t\t}else{\n\t\t\tres[record[i]] = false\n\t\t}\n\t}\n\treturn res\n}\n```
['Go']