Practice Find Winner on a Tic Tac Toe Game
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
On an initially empty 3 by 3 grid, players A and B alternate moves, with A first. A places X and B places O in an empty cell. A player wins by filling an entire row, column, or diagonal with their mark; a full board without a winner is a draw. No moves follow the end of a game. The valid sequence moves contains [row, column] pairs. Return "A" or "B" for a winner, "Draw" for a completed draw, or "Pending" if play can continue.
Source: Find Winner on a Tic Tac Toe Game on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
moves = [[0,0],[2,0],[1,1],[2,1],[2,2]]
"A"
# Example 2
moves = [[0,0],[1,1],[0,1],[0,2],[1,0],[2,0]]
"B"
# Example 3
moves = [[0,0],[1,1],[2,0],[1,0],[1,2],[2,1],[0,1],[0,2],[2,2]]
"Draw"
Constraints
Related LeetCode Problems
Practice more problems similar to Find Winner on a Tic Tac Toe Game.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.