dsalgo 0.3.10

A package for Datastructures and Algorithms.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
pub fn lsb_num(n: i64) -> i64 {
    n & -n
}

mod tests {

    use super::*;

    #[test]

    fn test() {
        let cases = vec![(0, 0), (1, 1), (2, 2), (3, 1)];

        for (n, ans) in cases {
            assert_eq!(lsb_num(n), ans);
        }
    }
}