Strong Password Checker
Hard · String, Greedy, Heap (Priority Queue)
A password is considered strong if the below conditions are all met:
Given a string password, return the minimum number of steps required to make password strong. if password is already strong, return 0.
In one step, you can:
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 '!'.
Starter code (python)
class Solution(object):
def strongPasswordChecker(self, password):
"""
:type password: str
:rtype: int
"""
Related problems
- Longest Substring Without Repeating Characters (Medium)
- Longest Palindromic Substring (Medium)
- Container With Most Water (Medium)
Previous: Battleships in a Board · Next: Maximum XOR of Two Numbers in an Array · All problems
Zepruv is a technical interview practice platform. Read any problem for free; sign in to run your code, submit and keep your progress.