• + 0 comments

    RUST:

    fn jumpingOnClouds(c: &[i32]) -> i32 {
        let n = c.len() - 1;
        let mut jumps = 0;
        let mut position = 0;
    
        while position < n {
            if position + 2 <= n && c[position + 2] == 0 {
                position += 2;
            } else {
                position += 1;
            }
            jumps += 1;
        }
        jumps
    }