Class Solution
- java.lang.Object
-
- g0401_0500.s0420_strong_password_checker.Solution
-
public class Solution extends Object
420 - Strong Password Checker.Hard
A password is considered strong if the below conditions are all met:
- It has at least
6characters and at most20characters. - It contains at least one lowercase letter, at least one uppercase letter, and at least one digit.
- 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).
Given a string
password, return the minimum number of steps required to makepasswordstrong. ifpasswordis already strong, return0.In one step, you can:
- Insert one character to
password, - Delete one character from
password, or - Replace one character of
passwordwith another character.
Example 1:
Input: password = “a”
Output: 5
Example 2:
Input: password = “aA1”
Output: 3
Example 3:
Input: password = “1337C0d3”
Output: 0
Constraints:
1 <= password.length <= 50passwordconsists of letters, digits, dot'.'or exclamation mark'!'.
- It has at least
-
-
Constructor Summary
Constructors Constructor Description Solution()
-
-
-
Method Detail
-
strongPasswordChecker
public int strongPasswordChecker(String s)
-
-