C++ 79 ms
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 intersect(const vector<int>& a, const vector<int>& b, int k) {
        constexpr int len = 101;

        bool A[len] {};
        for(auto i : a) A[i] = true;

        bool B[len] {};
        for(auto i : b) B[i] = true;

        for(int i = 0; i < len; ++i)
            if(A[i] and B[i] and !--k)
                return true;

        return false;
    }

    void BFS(const vector<vector<int>>& graph, vector<bool>& visited, int curr) {
        queue<int> vertices;
        visited[curr] = true;
        vertices.push(curr);
        while(!vertices.empty()) {
            curr = vertices.front();
            vertices.pop();
            for(auto next : graph[curr]) {
                if(visited[next]) continue;
                visited[next] = true;
                vertices.push(next);
            }
        }
    }

    int numberOfComponents(const vector<vector<int>>& properties, const int k) {
        const int len = size(properties);
        vector<vector<int>> graph(len);

        for(int first = 0; first < len - 1; ++first) {
            for(int second = first + 1; second < len; ++second) {
                if(intersect(properties[first], properties[second], k)) {
                    graph[first].push_back(second);
                    graph[second].push_back(first);
                }
            }
        }

        int count = 0;
        vector<bool> visited(len);
        
        for(int i = 0; i < len; ++i) {
            if(visited[i]) continue;
            BFS(graph, visited, i);
            ++count;
        }

        return count;
    }
};
```
['C++']