Vowel Substring Game
Updated
Problem statement
You are given an array datasets of strings. For each string, two engineers play a turn-based game by repeatedly removing substrings under the following rules:
- Alex moves first and may remove any substring containing an odd number of vowels
- Chris moves next and may remove any substring containing an even number of vowels
- They continue alternating turns in the same manner
- Both play optimally
- The player who removes the last valid substring wins
Note:
- Vowels are
'a','e','i','o', and'u'
For each string, determine which engineer wins and return the result accordingly.
Function
determineWinners(datasets: String[]) → String[]Examples
Example 1
datasets = ["git", "dry"]return = ["Alex", "Chris"]Given n = 2 and datasets = ["git", "dry"]
- For the
datasets[0] = "git", Alex removes the entire string, leaving it empty. Since no valid moves are left, Chris cannot make a move, and Alex performs the final removal. - For the
datasets[1] = "dry", the string contains no vowels. Since Alex cannot make any moves, Chris is considered to have made the final removal.
Hence the answer is ["Alex", "Chris"].
Example 2
datasets = ["lgzpc", "lchxlo", "xnwzg"]return = ["Chris", "Alex", "Chris"]Sample Input For Custom Testing
| STDIN | FUNCTION |
|---|---|
| |
Sample Output
Chris
Alex
ChrisExplanation
Chris takes the first and third datasets which contain no vowels. Since Alex cannot make a move, Chris is considered to have made the final valid removal.
In the second dataset, datasets[1] = "lchxlo", there is exactly one vowel. Alex removes the entire string.
Constraints
1 ≤ n ≤ 1001 ≤ |datasets[i]| ≤ 10^5- All strings in the datasets consist of lowercase English letters only.
More Akuna Capital Online Assessment questions
- Delivery Management SystemOA · Seen Nov 2026
- Count Server ReplacementsOA · Seen Nov 2026
- Match Orders by Price and Arrival TimeOA · PHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Maximum Remaining Drone PowerOA · Seen Nov 2026
- Rolling MetricsOA · Seen Oct 2026
- Competitive ForagingOA · Seen Sep 2026
- Binary CircuitOA · Seen Sep 2026
- Items SortOA · Seen Sep 2026
- Minimize Malware Spread by Removing a NodeOA · Seen Sep 2026
- K Smallest SubstringOA · Seen Sep 2026
Similar questions at other companies
- Basic Calculator IITypeSafe AI · OA
- Perfect Squares Matching a PatternNielsen · OA
- Simplify a Quadratic ExpressionOpenAI · OAOpenAI interview questions
- Next Number with Disjoint DigitsElevenLabs · OAElevenLabs interview questions
- Minimum Anagram PeriodVisa · OAVisa interview questions
- Return Exact Cash Register ChangeBank of America · OABank of America interview questions
- Maximum Equal Parts for PrefixesAmazon · OA
- Minimum Anagram PeriodWells Fargo · OAWells Fargo interview questions
- Minimum Digit Swaps for the Smallest DifferenceLSEG · OALSEG interview questions
- Vowel Substring Deletion GameJP Morgan Chase · OAJP Morgan Chase interview questions
Akuna Capital interview experiences
- Akuna Capital Quant Trader and QR Interviews: 5 Experiences
- Akuna Capital JQR CodePair Rounds: 8 Experiences (Part 6 of 6)
- Akuna Capital QR Probability Phones: 14 Experiences (Part 5 of 6)
- Akuna Capital QR-ML Interviews: 11 Experiences (Part 4 of 6)
- Akuna Capital QR Regression Rounds: 11 Experiences (Part 3 of 6)
- Akuna Capital QR Coding Interviews: 17 Experiences (Part 2 of 6)