Problem · String
Find Password Strength
Learn this problemProblem statement
Sup! I might be a sister question of Password Strength 🐣
Your group at Amazon has recently set up a fresh verification rule for internal employee login credentials.
A credential consists solely of lowercase English alphabets and is deemed acceptable only if it includes at least one vowel and at least one consonant. The vowel set includes 'a', 'e', 'i', 'o', 'u'. All other letters are treated as consonants.
Given a text string representing the credential, determine and return its strength value. If the entire credential fails to meet the criteria, return 0.
Note: A piece refers to a sequence of neighboring characters taken from the original string, maintaining the same order.
Function
findPasswordStrength(credential: String) → intExamples
Example 1
credential = "hackerrank"return = 3This credential can be broken down into three consecutive sections: "hack", "er", and "rank". Every section includes at least one vowel and one consonant.
It can be verified that the string cannot be split into more than three valid sections. Therefore, the strength value of the credential is 3.
Constraints
1 ≤ |credential| ≤ 10(the length of credential)- Credential consists of lowercase English letters only.
More Amazon problems
- Secure Maximum DeliveriesOA · Seen Jul 2026
- Find Median from Data StreamONSITE INTERVIEW · Seen Jul 2026
- Handwritten SigmoidPHONE SCREEN · Seen Jul 2026
- Handwritten SoftmaxPHONE SCREEN · Seen Jul 2026
- Koko Eating BananasONSITE INTERVIEW · Seen Jul 2026
- Loyal Customers Across Two DaysONSITE INTERVIEW · Seen Jul 2026
- Maximum System Memory CapacityOA · Seen Jul 2026
- Package Delivery SystemOA · Seen Jul 2026