Use sets to find edge condition and DSU to get no. of components
IntuitionUse sets to find edge condition and DSU to get no. of componentsCode
# Intuition
Use sets to find edge condition and DSU to get no. of components

# Code
```cpp []
class Solution {
public:

    class DSU {
    public:
        int n;
        vector<int> parent, rank;

        DSU(int _n) {
            n = _n;

            parent.resize(n);
            rank.resize(n, 1);
            for (int i = 0; i < n; i++) {
                parent[i] = i;
            }
        }

        void combine(int x, int y) {
            int rx = find(x);
            int ry = find(y);
            if (rx == ry) { return; }
            if (rank[rx] > rank[ry]) {
                parent[ry] = rx;
            } else if (rank[ry] > rank[rx]) {
                parent[rx] = ry;
            } else {
                rank[rx]++;
                parent[ry] = rx;
            }
        }

        int find(int x) {
            if (parent[x] != x) {
                parent[x] = find(parent[x]);
            }
            return parent[x];
        }
    };

    int numberOfComponents(vector<vector<int>>& properties, int k) {
        int n = properties.size();
        DSU dsu(n);

        vector<unordered_set<int>> sets;
        for (int i = 0; i < n; i++) {
            unordered_set<int> s(properties[i].begin(), properties[i].end());
            sets.push_back(s);
        }
        for (int i = 0; i < n; i++) {
            for (int j = i + 1; j < n; j++) {
                if (edgeExists(sets[i], sets[j], k)) {
                    dsu.combine(i, j);
                }
            }
        }

        unordered_set<int> roots;
        for (int i = 0; i < n; i++) {
            roots.insert(dsu.find(i));
        }
        return roots.size();
    }

    bool edgeExists(unordered_set<int> &s1, unordered_set<int> &s2, int k) {
        if (s1.size() < s2.size()) {
            return edgeExists(s2, s1, k); // iterate over smaller set for efficiency
        }
        int count = 0;
        for (int num : s2) {
            if (s1.find(num) != s1.end()) { // exists in both sets
                count++;
            }
            if (count >= k) {
                return true;
            }
        }
        return false;
    }
};
```
['Strongly Connected Component', 'C++']