Hello! Did you navigate here from my sister question Password Strength π£?
Another check pwd strength question you might be interested in:
Find the password strength for a given password. For example, if the password is "good",
then iterate over all substrings and find the distinct character counts:
g= 1,o= 1,o= 1,d= 1,go= 2,oo= 1,od= 2,goo= 2,ood= 2,good= 3
At the end, add all the distinct character counts to determine the password strength. In this case, the password strength is 16.
Complete the function findPasswordStrength in the editor.
findPasswordStrength has the following parameter:
String password: the password string
Returns
int: the password strength
Examples
01 Β· Example 1
password = "good" return = 16
Iterate over all substrings and find the distinct character counts:
g= 1,o= 1,o= 1,d= 1,go= 2,oo= 1,od= 2,goo= 2,ood= 2,good= 3
02 Β· Example 2
password = "aa" return = 2

Iterate over all substrings and find the distinct character counts:
"a"
"a"
"aa"
We return 2 because both "a" and "a" have dictinct character counts of 1.
1 + 1 = 2
This case was added on 03-22-2025 :) Here is the source img -
Constraints
πMore Amazon problems
- Minimum Operations to Make the Integer ZeroSeen Jun 2026
- Create Array Generator ServiceSeen Jun 2026
- Minimum Merge ConflictsOA Β· Seen Jun 2026
- Get Minimum AmountOA Β· Seen Jun 2026
- Drone Delivery RouteOA Β· Seen Jun 2026
- Find Maximum Total Amount (SDE I, Fungible :)Seen Jun 2026
- Minimum Operations to Make Array ValidOA Β· Seen Jun 2026
- Sort Bug Report FrequenciesOA Β· Seen Jun 2026
public int findPasswordStrength(String password) {
// write your code here
}
password"good"
expected16
checking account