Tap here to switch tabs
Problem
Submissions

Problem: Vowels Game in a String

med
30 min
Try to solve the Vowels Game in a String problem.

Statement

Alice and Bob are playing a game on a string s, where Alice takes the first turn.

On a player’s turn, they must choose and remove a non empty substring from s based on the following rules:

  • Alice may choose any non empty substring containing an odd number of vowels.

  • Bob may choose any non empty substring containing an even number of vowels.

The first player unable to make a valid move on their turn loses the game.

Assuming both players play optimally, return true if Alice wins the game, and false otherwise.

English vowels are defined as the characters 'a', 'e', 'i', 'o', and 'u'.

Constraints:

  • 1≤1 \leq s.length ≤105\leq 10^5

  • s consists only of lowercase English letters.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Vowels Game in a String

med
30 min
Try to solve the Vowels Game in a String problem.

Statement

Alice and Bob are playing a game on a string s, where Alice takes the first turn.

On a player’s turn, they must choose and remove a non empty substring from s based on the following rules:

  • Alice may choose any non empty substring containing an odd number of vowels.

  • Bob may choose any non empty substring containing an even number of vowels.

The first player unable to make a valid move on their turn loses the game.

Assuming both players play optimally, return true if Alice wins the game, and false otherwise.

English vowels are defined as the characters 'a', 'e', 'i', 'o', and 'u'.

Constraints:

  • 1≤1 \leq s.length ≤105\leq 10^5

  • s consists only of lowercase English letters.