fn is_valid_password(password: &Vec<char>) -> bool {
    let mut inc_seq: usize = 1;
    let mut inc_seq_max: usize = 1;

    let mut pair_prev: Option<usize> = None;
    let mut pair_len: usize = 0;

    // Iter from Left -> Right
    let mut prev: Option<char> = None;
    for (i, c) in password.iter().enumerate() {
        if LIO.contains(c) {
            return false;
        }

        // Ascending sequences
        if prev.is_some() && ((prev.unwrap() as u8) + 1) as char == *c {
            inc_seq += 1;
            inc_seq_max = std::cmp::max(inc_seq, inc_seq_max);
        } else {
            inc_seq = 1;
        }

        // Non-overlapping pairs
        if prev.is_some() && prev.unwrap() == *c {
            if pair_prev.is_none() || pair_prev.unwrap() + 1 != i {
                pair_prev = Some(i);
                pair_len += 1;
            }
        }

        prev = Some(*c);
    }
    inc_seq_max >= 3 && pair_len >= 2
}
// Returns Some() if the password was invalid. Returns None if valid
Returns Some() if the password was invalid. Returns None if valid
Returns Some () if the password was invalid . Returns None if valid
fn is_valid_password(password: &Vec<char>) -> bool {
    let mut inc_seq: usize = 1;
    let mut inc_seq_max: usize = 1;
    let mut pair_prev: Option<usize> = None;
    let mut pair_len: usize = 0;
    // Iter from Left -> Right
    let mut prev: Option<char> = None;
    for (i, c) in password.iter().enumerate() {
        if LIO.contains(c) {
            return false;
        }
        // Ascending sequences
        if prev.is_some() && ((prev.unwrap() as u8) + 1) as char == *c {
            inc_seq += 1;
            inc_seq_max = std::cmp::max(inc_seq, inc_seq_max);
        } else {
            inc_seq = 1;
        }
        // Non-overlapping pairs
        if prev.is_some() && prev.unwrap() == *c {
            if pair_prev.is_none() || pair_prev.unwrap() + 1 != i {
                pair_prev = Some(i);
                pair_len += 1;
            }
        }
        prev = Some(*c);
    }
    inc_seq_max >= 3 && pair_len >= 2
}
fn is_valid_password ( password : & Vec < char > ) -> bool { let mut inc_seq : usize = 1 ; let mut inc_seq_max : usize = 1 ; let mut pair_prev : Option < usize > = None ; let mut pair_len : usize = 0 ; // Iter from Left -> Right let mut prev : Option < char > = None ; for ( i , c ) in password . iter ( ) . enumerate ( ) { if LIO . contains ( c ) { return false ; } // Ascending sequences if prev . is_some ( ) && ( ( prev . unwrap ( ) as u8 ) + 1 ) as char == * c { inc_seq += 1 ; inc_seq_max = std :: cmp :: max ( inc_seq , inc_seq_max ) ; } else { inc_seq = 1 ; } // Non-overlapping pairs if prev . is_some ( ) && prev . unwrap ( ) == * c { if pair_prev . is_none ( ) || pair_prev . unwrap ( ) + 1 != i { pair_prev = Some ( i ) ; pair_len += 1 ; } } prev = Some ( * c ) ; } inc_seq_max >= 3 && pair_len >= 2 }
Returns Some() if the password was invalid.
Returns Some () if the password was invalid .
password
&Vec<char>