• + 0 comments

    In RUST

    fn breakingRecords(scores: &[i32]) -> Vec<i32> {
        let mut highest = scores[0];
        let mut lowest = scores[0];
        let mut count_highest = 0;
        let mut count_lowest = 0;
    
        for &score in scores.iter() {
            if score > highest {
                highest = score;
                count_highest += 1;
            } else if score < lowest {
                lowest = score;
                count_lowest += 1;
            }
        }
        vec![count_highest, count_lowest]
    }