Minimum Changes to Balance Vowels and Consonants
Updated
Problem statement
A password is balanced when it has equally many vowels and consonants. The vowels are a, e, i, o, u.
In one operation, change one letter to the previous or next letter of the alphabet. You cannot move before a or after z, and letters do not wrap around.
Return the minimum number of operations needed to balance password.
Function
countMinimumOperations(password: String) → intExamples
Example 1
password = "hack"return = 1Change h to i in one operation. The result iack has two vowels and two consonants.
Example 2
password = "zz"return = 5Change one z to u using five decrements. One character is then a vowel and one is a consonant.
Constraints
- For this exercise, assume 2 <= password.length <= 100000 and password.length is even.
- password contains only lowercase English letters.
Source note: Original OA task images and any included source example. The practice contract follows the rules stated in the problem and source note.
More Adobe Online Assessment questions
- Base Unit ConversionsOA · Seen Nov 2026
- Rotate an Array In PlaceOA · PHONE SCREEN · Seen Aug 2026
- Top-Funded Villages and ProjectsOA · Seen Aug 2026
- Count Parent Nodes With a Target SumOA · Seen Aug 2026
- Largest Binary Number by ConcatenationOA · Seen Aug 2026
- Count Events by CategoryOA · Seen Aug 2026
- Graph M-ColoringOA · Seen Aug 2026
- Hall of Shifting TilesOA · Seen Aug 2026
- K-th Ancestor Subtree Preorder QueryOA · Seen Aug 2026
- Maze ReachabilityOA · Seen Aug 2026
Similar questions at other companies
- Maximize Workday EarningsCitadel · OA · PHONE SCREEN · ONSITE INTERVIEWCitadel interview questions
- Return Exact Cash Register ChangeBank of America · OABank of America interview questions
- Maximize Palindromic WordsSquarepoint Capital · OASquarepoint Capital interview questions
- Swap Parity (Data Scientist / Analytics :)JP Morgan Chase · OAJP Morgan Chase interview questions
- Doing Smart WorkRubrik · OARubrik interview questions
- Swap ParityPalantir · OAPalantir interview questions
- Join Numbers into the Largest ValueExpedia · ONSITE INTERVIEWExpedia interview questions
- Hiking Club Fastest PaceInfosys · OAInfosys interview questions
- Maximum String OperationsMicrosoft · OAMicrosoft interview questions
- Minimum No-Repeat Segments After One Character RemovalSalesforce · OASalesforce interview questions
Adobe interview experiences
- Adobe New Grad OA: Unit Conversion and Code Review: 1 Experience
- Adobe Web, QA, DevOps, ML Roles: 13 Experiences (Part 3 of 3)
- Adobe SWE Interviews, Level Unknown: 25 Experiences (Part 2 of 3)
- Adobe Interviews, Level Unknown: 38 Experiences (Part 1 of 3)
- Adobe New Grad MTS Interview Questions: 7 Experiences
- Adobe ML/Research Intern Interviews: 12 Experiences (Part 4 of 4)