[Go] union-find data structure 
IntuitionApproachComplexity
Time complexity:

Space complexity:
Code
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->

# Approach
<!-- Describe your approach to solving the problem. -->

# Complexity
- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```golang []
func numberOfComponents(properties [][]int, k int) int {
    n := len(properties)
    ps := []map[int]struct{}{}
    for _, p := range properties {
        elem := map[int]struct{}{}
        for _, x := range p {
            elem[x] = struct{}{}
        }
        ps = append(ps, elem)
    }
    parent := make([]int, n)
    for i := 0; i < n; i++ {
        parent[i] = i
    }

    var find func(p int) int
    find = func(p int) int {
        if (p != parent[p]) {
            parent[p] = find(parent[p])
        }
        return parent[p]
    }

    for i := 0; i < n; i++ {
        for j := i+1; j < n; j++ {
            cnt := 0
            for x, _ := range ps[i] {
                if _, ok := ps[j][x]; ok {
                    cnt++
                }
            }
            if cnt >= k {
                parent[find(i)] = find(j)
            }
        }
    }
    freq := map[int]int{}
    for _, x := range parent {
        freq[find(x)]++
    }
    return len(freq)
}
```
['Go']