Amazon Online Assessment 2021 (OA) - Find Password Strength
The folks who design security strategies for online platforms have created a fresh way to gauge how strong a username is. This method works only on usernames that use lower case English alphabets. To get the strength of a username, they tally up the different kinds of alphabets used in all potential chains of characters that can be made from that username.
Here's a thing to remember: any chain of characters we take from a username has to be in the same order as in the username. Given a username, you have to find out how strong it is based on these rules.
Relevant Amazon OA Problems:
- Recent Items
- Max Subjects Number
- Find Password Strength
- Economy Mart
- Pth Factor
- Unique Character
- Common Prefix
Input
password
: the password
Output
the strength of the password
Examples
Example 1:
Input:
password = good
Output: 16
Explanation:
Thus, password strength = 1 + 1 + 1 + 1 + 2 + 1 + 2 + 2 + 3 = 16.
Example 2:
Input:
password = test
Output: 19
Explanation:
Example 3:
Input:
password = abc
Output: 10
Explanation: