You are viewing a single comment's thread. Return to all comments →
Rust best solution If you’re looking for solutions to the 3-month preparation kit in either Python or Rust, you can find them below: my solutions
fn strong_password(n: i32, password: &str) -> i32 { let special_characters: std::collections::HashSet<char> = "!@#$%^&*()-+".chars().collect(); let mut add_lower = true; let mut add_upper = true; let mut add_special = true; let mut add_number = true; for letter in password.chars() { if letter.is_uppercase() { add_upper = false; } if letter.is_lowercase() { add_lower = false; } if letter.is_numeric() { add_number = false; } if special_characters.contains(&letter) { add_special = false; } } let mut characters_to_add: i32 = 0; if add_lower { characters_to_add += 1; } if add_upper { characters_to_add += 1; } if add_special { characters_to_add += 1; } if add_number { characters_to_add += 1; } if (password.len() + characters_to_add as usize) < 6 { return 6 - password.len() as i32; } characters_to_add }
Seems like cookies are disabled on this browser, please enable them to open this website
Strong Password
You are viewing a single comment's thread. Return to all comments →
Rust best solution
If you’re looking for solutions to the 3-month preparation kit in either Python or Rust, you can find them below: my solutions