dsalgo/
xor_vector_space_basis_with_cumulative_min.rs

1pub fn xor_basis(a: &[u64]) -> Vec<u64> {
2    let mut basis = vec![];
3
4    for &x in a {
5        let mut x = x;
6
7        for y in basis.clone().into_iter() {
8            x = x.min(x ^ y);
9        }
10
11        if x != 0 {
12            basis.push(x);
13        }
14    }
15
16    basis
17}
18
19#[cfg(test)]
20
21mod tests {
22
23    use super::*;
24
25    #[test]
26
27    fn test() {}
28}