Similar Password 🪴 (Singapore)
Learn this problemProblem statement
A password detection system for HackerRank accounts detects a password as similar if the number of vowels is equal to the number of consonants in the password.
Passwords consist of lowercase English characters only, and vowels are ('a', 'e', 'i', 'o', 'u').
To check the strength of a password and how easily it can be hacked, some manipulations can be made to the password. In one operation, any character of the string can either be incremented or decremented. For example, 'f' can be incremented to 'g', or decremented to 'e'. Note that character 'a' cannot be decremented and 'z' cannot be incremented.
Find the minimum number of operations in which the password can be made similar.
Function
countMinimumOperations(password: String) → int
Complete the function countMinimumOperations in the editor below.
countMinimumOperations has the following parameter:
string password: the password
Returns
int: the minimum number of operations
Examples
Example 1
password = "hack"return = 1Example 2
password = "abcd"return = 1Example 3
password = "bigbangt"return = 2Constraints
Unknown for now