Jobs
Interviews

Solve Tic-Tac-Toe Game Status using Python Language

Solve Tic-Tac-Toe Game Status using Python to enhance your skills with python coding practice , master coding concepts, and prepare for interviews with practical exercises and detailed solutions.

Tic-Tac-Toe Game Status

Difficulty : Easy

Categories :

In a tic-tac-toe game, given an n x n board filled with characters from 'X', 'O', and empty spaces ' ', determine if someone has won the game or if it's still ongoing. Return 'X' if X wins, 'O' if O wins, 'Draw' if the game is over with no winner, or 'Pending' if the game is still ongoing.

Constraints:

  • n == board.length == 3
  • board[i] contains only 'X', 'O', or ' '
  • Input represents a valid game state

Examples:

Input:
["XOX",
 "OXO",
 "XOX"]
Output: "Draw"
Explanation: No more moves possible, no winner
Input:
["XOX",
 "O O",
 "XOX"]
Output: "Pending"
Explanation: Game can continue
Input:
["XXX",
 "OOX",
 "OOX"]
Output: "X"
Explanation: X wins with top row

Coding works best on a laptop or desktop, with a keyboard and a wider editor. You can read the problem here and solve it there.

Problem Solving

Input

What You'll Find Here

Interactive Exercises Practice coding with problems designed for beginners and experts.

Step-by-Step Solutions Understand every step of the solution process.

Real-World Scenarios Apply your skills to real-world problems and boost your confidence.

Choose from the following categories