just use union find 🙂
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
```java []

import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;

class Solution {

    class UnionFind {

        int[] parent;
        int count;

        public UnionFind(int count) {

            parent = new int[count];
            for (int i = 0; i < count; i++) {

                parent[i] = i;
            }
            this.count = count;
        }

        public int find(int a) {

            int rootA = parent[a];

            if (rootA != a) {
                rootA = find(rootA);
            }

            return rootA;

        }

        public void union(int a, int b) {

            int rootA = find(a);
            int rootB = find(b);

            if (rootA != rootB) {

                parent[rootB] = rootA;
                count--;
            }

        }

        public int getCount() {

            return count;
        }

    }

    public int numberOfComponents(int[][] properties, int k) {

        int n = properties.length;
        int m = properties[0].length;

        Map<Integer, Set<Integer>> mp = new HashMap<>();
        for (int i = 0; i < n; i++) {

            int[] st = properties[i];
            mp.put(i, Arrays.stream(st).boxed().collect(Collectors.toSet()));
        }

        int x = n;

        UnionFind uf = new UnionFind(x);
        for (int i = 0; i < n; i++) {

            for (int j = i + 1; j < n; j++) {

                if (isConnected(i, j, mp, k))
                    uf.union(i, j);
            }
        }

        return uf.getCount();
    }

    private boolean isConnected(int i, int j, Map<Integer, Set<Integer>> mp, int k) {

        Set<Integer> intersectionSet = new HashSet<>(mp.get(i));

        intersectionSet.retainAll(mp.get(j));

        return intersectionSet.size() >= k;

    }
}
```
['Java']