easiest java code !.......
IntuitionApproachwe have to build the graph with the common elements of the two  selected arrays , so iterate over the 2d array and select two arrays properties
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->simply building the graph and counting the connected component

# Approach
<!-- Describe your approach to solving the problem. -->
we have to build the graph with the common elements of the two  selected arrays , so iterate over the 2d array and select two arrays properties[i] , properties[j]  find there common elements and if they are >= k then i,j have an edge between them , after the graph is ready just apply dfs and count the connected components 

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

O(n^2 * m)

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

# Code
```java []
class Solution {
    public int numberOfComponents(int[][] properties, int k) {
        int n = properties.length;
        int m = properties[0].length;

        ArrayList<Integer> list[] = new ArrayList[n];

        for (int i = 0; i < list.length; i++) {
            list[i] = new ArrayList<>();
        }

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

                Set<Integer> set1 = new HashSet<>();
                Set<Integer> set2 = new HashSet<>();
                for (int num : properties[i])
                    set1.add(num);

                for (int num : properties[j])
                    set2.add(num);

                set1.retainAll(set2);
                

                if (set1.size() >= k) {
                    list[i].add(j);
                    list[j].add(i);
                }
            }
        }

        int ans = helper(list);
        return ans;
    }

    public static int helper(ArrayList<Integer> list[]) {
        boolean vis[] = new boolean[list.length];
        int count = 0;

        for (int i = 0; i < list.length; i++) {
            if (vis[i] != true) {
                count++;
                dfs(list, i, vis);
            }
        }

        return count;
    }

    public static void dfs(ArrayList<Integer> list[], int curr, boolean vis[]) {

        vis[curr] = true;

        for (int i = 0; i < list[curr].size(); i++) {
            int neigh = list[curr].get(i);

            if (vis[neigh] == false) {
                dfs(list, neigh, vis);
            }
        }
    }
}
```
['Java']