Skip to content

Practice Strong Password Checker

Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.

Hard#420
LeetCode Problem

Strong Password Checker

Problem Statement

A strong password has 6 through 20 characters, includes at least one lowercase letter, one uppercase letter, and one digit, and contains no run of three or more identical consecutive characters. In one step, you may insert a character, delete a character, or replace one character with another. Return the minimum number of steps needed to make password strong, or 0 if it already is.

Source: Strong Password Checker on LeetCode. Use the original task for its coding environment and submissions.

Examples

# 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 <= 50
password consists of letters, digits, dot '.' or exclamation mark '!'.

Related LeetCode Problems

Practice more problems similar to Strong Password Checker.

Review your practice with PhantomCodeAI

After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.