Facebook Pixel

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:

Input & Output
Input
password — the password
Output
the strength of the password
Example
Input
password = good
Output
16
Explanation

password-good

Thus, password strength = 1 + 1 + 1 + 1 + 2 + 1 + 2 + 2 + 3 = 16.

Example
Input
password = test
Output
19
Example
Input
password = abc
Output
10

Try it yourself

Invest in Yourself
Your new job is waiting. 83% of people that complete the program get a job offer. Unlock unlimited access to all content and features.
Go Pro