The Find Winner on a Tic Tac Toe Game interview question asks you to determine the state of a game board after a sequence of moves. The two players, A and B, take turns placing their marks ('X' and 'O'). You need to return "A" or "B" if a player wins, "Draw" if the board is full with no winner, or "Pending" if moves remain and no one has won yet.
Companies like Apple and Microsoft use the Find Winner coding problem as a warm-up. It tests basic array indexing, simulation skills, and clean conditional logic. It evaluations whether you can efficiently check for win conditions (rows, columns, and diagonals) without redundant code. It’s a standard Simulation interview pattern.
This problem follows the Matrix Win Condition pattern.
Moves: [[0,0], [1,1], [0,1], [0,2], [1,0], [2,0]]
if statements instead of using a loop or counters.For grid-based games, always separate the State Update logic from the Win Condition logic. This makes your code more modular and easier to adapt if the board size increases (e.g., a board).
| Title | Difficulty | Topics | LeetCode |
|---|---|---|---|
| Equal Row and Column Pairs | Medium | Solve | |
| Transpose Matrix | Easy | Solve | |
| Convert 1D Array Into 2D Array | Easy | Solve | |
| Design Tic-Tac-Toe | Medium | Solve | |
| Reshape the Matrix | Easy | Solve |