← 返回 snowflake 的题目列表Extended Tic-Tac-Toe State Validation
类型:online_judge
Given a 3x3 Tic-Tac-Toe board containing 'X', 'O', and ' ' (empty) characters, you need to determine if the board state is valid with some extended logic:
The number of 'X's cannot exceed the number of 'O's by more than one.
The number of 'O's cannot be greater than the number of 'X's.
The game cannot continue after one player has already won.
Handle new rules like a game continuing after a win condition is reached.
Return a boolean indicating if the state is valid. Example:
Input: ['XOX', 'X O', 'OXO'], Output: False
Input: ['XOX', 'OOX', 'XOX'], Output: True
Data limit: The input is always a 3x3 character array.
Example
Input
['XOX', 'X O', 'OXO']