Logo
IconChallenge
Icon
IconProblem
IconSolutions
IconSubmissions

Vowels Game in a String

XPChallenge Points: 20
levelLevel: Medium

Two players, Alice and Bob, are playing a game using a string s consisting of lowercase English letters.
• Alice goes first, followed by Bob, and they alternate turns.
• On Alice’s turn, she must remove any non-empty substring that contains an odd number of vowels.
• On Bob’s turn, he must remove any non-empty substring that contains an even number of vowels.
• The game continues until one player cannot make a valid move — that player loses the game.
• Both players play optimally.
Return true if Alice wins, or false if Bob wins.
The vowels are: a, e, i, o, u.

Example 1:

Input: s = "bcdfg"

Output: false

Example 2:

Input: s = "education"

Output: true

to Continue
like
dislike

Accepted:

Submission:

IconReport an issue
Icon
IconCode
IconYou need toto run or submitYou need toto run or submit
IconTest Case
IconTest Result