DSU soln
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
```cpp []
class Solution {
public:
    bool isedge(set <int> &a, set <int> &b,int k)
    {int ans=0;
        for(auto p:a)
        {
            if(b.find(p)!=b.end())
            ans++;
        }
        return ans>=k;
    }
    int getparent(int a,vector <int> &parent)
    {
        if(a==parent[a])
        return a;
        return parent[a]=getparent(parent[a],parent);
    }
    int numberOfComponents(vector<vector<int>>& properties, int k) {
        int n=properties.size();
        vector <int> parent(n);
        vector <set<int> > op(n);
        for(int i=0;i<n;i++)
        {
            for(auto p:properties[i])
            op[i].insert(p);
        }
        for(int i=0;i<n;i++)
            parent[i]=i;
        int ans=n;
        for(int i=0;i<n;i++)
        for(int j=i+1;j<n;j++)
        {
            int x= getparent(i,parent),y=getparent(j,parent);
            if(x!=y and isedge(op[i],op[j],k))
            {
                parent[x]=parent[y];
                ans--;
            }
        }
        return ans;
    }
};
```
['C++']