Compare the Triplets

  • + 0 comments

    My rust solution

    fn compareTriplets(a: &[i32], b: &[i32]) -> Vec<i32> {
            a.iter().zip(b.iter()).fold(vec![0,0], |mut a, b| {
            if b.0 > b.1 {
                a[0] += 1;
            } else if b.0 < b.1 {
                a[1] += 1;
            }
            a
        })
    }