The Wording Game - Problem
The Wording Game is an exciting two-player word competition between Alice and Bob! ๐ฎ
Each player has their own lexicographically sorted array of words. The game follows these strategic rules:
๐ฏ Goal: Be the last player able to make a valid move
๐ Rules:
โข Players alternate turns, with Alice starting first using her lexicographically smallest word
โข Each subsequent word must be "closely greater" than the previous word
โข The first player unable to make a valid move loses
๐ "Closely Greater" Definition:
A word
1.
2. The first letter of
Example: "care" is closely greater than "book" (c comes after b) and "car" (same first letter, lexicographically greater), but NOT closely greater than "ant" (c is not immediately after a) or "cook" (care < cook lexicographically).
Given both players play optimally, determine if Alice can guarantee a win!
Each player has their own lexicographically sorted array of words. The game follows these strategic rules:
๐ฏ Goal: Be the last player able to make a valid move
๐ Rules:
โข Players alternate turns, with Alice starting first using her lexicographically smallest word
โข Each subsequent word must be "closely greater" than the previous word
โข The first player unable to make a valid move loses
๐ "Closely Greater" Definition:
A word
w is closely greater than word z if:1.
w is lexicographically greater than z2. The first letter of
w is either the same as the first letter of z, OR the next letter in the alphabetExample: "care" is closely greater than "book" (c comes after b) and "car" (same first letter, lexicographically greater), but NOT closely greater than "ant" (c is not immediately after a) or "cook" (care < cook lexicographically).
Given both players play optimally, determine if Alice can guarantee a win!
Input & Output
Constraints
๐ก
Explanation
AI Ready
๐ก Suggestion
Tab
to accept
Esc
to dismiss
// Output will appear here after running code