420. Strong Password Checker Hard

@problem@discussion
#String#Greedy#Heap (Priority Queue)



1/**
2 * [420] Strong Password Checker
3 *
4 * A password is considered strong if the below conditions are all met:
5 * 
6 * 	It has at least 6 characters and at most 20 characters.
7 * 	It contains at least one lowercase letter, at least one uppercase letter, and at least one digit.
8 * 	It does not contain three repeating characters in a row (i.e., "...aaa..." is weak, but "...aa...a..." is strong, assuming other conditions are met).
9 * 
10 * Given a string password, return the minimum number of steps required to make password strong. if password is already strong, return 0.
11 * In one step, you can:
12 * 
13 * 	Insert one character to password,
14 * 	Delete one character from password, or
15 * 	Replace one character of password with another character.
16 * 
17 *  
18 * Example 1:
19 * Input: password = "a"
20 * Output: 5
21 * Example 2:
22 * Input: password = "aA1"
23 * Output: 3
24 * Example 3:
25 * Input: password = "1337C0d3"
26 * Output: 0
27 *  
28 * Constraints:
29 * 
30 * 	1 <= password.length <= 50
31 * 	password consists of letters, digits, dot '.' or exclamation mark '!'.
32 * 
33 */
34pub struct Solution {}
35
36// problem: https://leetcode.com/problems/strong-password-checker/
37// discuss: https://leetcode.com/problems/strong-password-checker/discuss/?currentPage=1&orderBy=most_votes&query=
38
39// submission codes start here
40
41impl Solution {
42    pub fn strong_password_checker(password: String) -> i32 {
43        0
44    }
45}
46
47// submission codes end
48
49#[cfg(test)]
50mod tests {
51    use super::*;
52
53    #[test]
54    fn test_420() {
55    }
56}
57


Back
© 2025 bowen.ge All Rights Reserved.