Create Adjacency List then DFS  |  O(N * M) in 3ms  |  Rust
Complexity
Time complexity: O(N∗M)

Space complexity: O(N∗M)
Code
# Complexity
- Time complexity: $$O(N * M)$$
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

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

# Code
```rust []
impl Solution {
    pub fn number_of_components(properties: Vec<Vec<i32>>, k: i32) -> i32 {
        let n = properties.len();
        let mut adj = vec![vec![]; n];
        let mut visited = vec![false; n];
        let properties = properties.iter().map(|p|
            p.iter().fold(0u128, |acc, &x| acc | (1 << x))
        ).collect::<Vec<_>>();

        for i in 0..n {
            for j in 0..n {
                if i == j { continue };
                if (properties[i] & properties[j]).count_ones() >= k as _ {
                    adj[i].push(j);
                    adj[j].push(i);
                }
            }
        }
        
        (0..n).filter(|&i| dfs(i, &adj, &mut visited)).count() as _
    }
}

fn dfs(i: usize, adj: &Vec<Vec<usize>>, visited: &mut Vec<bool>) -> bool {
    if visited[i] {
        return false;
    }
    visited[i] = true;

    for &j in &adj[i] {
        dfs(j, adj, visited);
    }

    true
}
```
['Rust']