FastPrepTic-Tac-Toe Game Status
Problems/Tic-Tac-Toe Game Status

Tic-Tac-Toe Game Status

Google logoGoogle● MediumFULLTIMENEW GRADPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Write the logic that handles each move in a bigger version of Tic-Tac-Toe.

There are k players and an n x n board. Players take turns putting their own mark on an empty cell. Players are numbered 1 through k. Each move is written as [player, row, col]: the player who moves and the cell they pick. The move list alone decides who moves when. Nothing else checks that players go in a fixed order.

A player wins as soon as they have at least 3 of their marks next to each other in a straight line. The line can go across, down, or along a diagonal in either direction. You always need 3 in a line to win, even when n is larger than 3.

Go through the move list and return the game's status after each move:

  • "Game Over" if the game had already ended before this move. The game ends when someone has won or a Draw has been declared.
  • "Player X won" if player X wins with this move.
  • "Draw" if the board becomes full and nobody has won.
  • "In Progress" in every other case.

Every move is inside the board. If a move picks a cell that already has a mark, and the game is not over yet, leave the board as it is and return "Invalid Move" for that move.

Function

getGameStatus(k: int, n: int, moves: int[][]) → String[]

Examples

Example 1

k = 2n = 3moves = [[1,0,0],[2,1,0],[1,0,1],[2,1,1],[1,0,2]]return = ["In Progress","In Progress","In Progress","In Progress","Player 1 won"]

Player 1 completes three consecutive marks across the top row.

Example 2

k = 3n = 4moves = [[1,0,0],[2,0,1],[3,3,3],[1,1,1],[2,1,0],[3,2,1],[1,2,2]]return = ["In Progress","In Progress","In Progress","In Progress","In Progress","In Progress","Player 1 won"]

Player 1 completes the diagonal segment (0,0), (1,1), (2,2).

Constraints

  • 1 <= k <= 10
  • 3 <= n <= 103
  • 1 <= moves.length <= min(n2 + 5, 105)
  • Each move is [player, row, col], with 1 <= player <= k and 0 <= row, col < n.
  • Players do not have to move in a fixed order. Each move names the player who makes it.
  • Any move made after the game has ended must return "Game Over". The game ends when a winner has been declared or a Draw has been declared.

More Google Phone Screen questions

  • Route Pattern MatcherPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Periodic-Color Binary Forest RootsPHONE SCREEN · Seen Nov 2026
  • Evaluate a Nested Math ExpressionPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Best Stock Trade with Buy and Sell DaysPHONE SCREEN · Seen Nov 2026
  • Word Chain Jumps in a GridPHONE SCREEN · Seen Nov 2026
  • Dice-Walk Winning ProbabilityPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Lowest Common Ancestor in an N-ary TreePHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Apartment Housemate PreferencesPHONE SCREEN · Seen Nov 2026
  • Price at Query TimestampsPHONE SCREEN · Seen Nov 2026
  • Course Schedule Cycle DetectionPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026

Similar questions at other companies

  • Grid Infection with Recovery After D DaysOpenAI · PHONE SCREENOpenAI interview questions
  • Days Until Poisoned Plants StabilizeApple · PHONE SCREENApple interview questions
  • Apply a 2048 Board MoveGlean · PHONE SCREENGlean interview questions
  • Dense Matrix MultiplicationAmazon · PHONE SCREEN
  • File-Backed Dense Game of LifeApplied Intuition · PHONE SCREENApplied Intuition interview questions
  • Tilting Maze BallHudson River Trading · PHONE SCREENHudson River Trading interview questions
  • Spiral Order with ObstaclesTemu · PHONE SCREENTemu interview questions
  • Logistic Regression DiagnosticsLinkedIn · PHONE SCREENLinkedIn interview questions
  • Spiral Matrix TraversalByteDance · PHONE SCREENByteDance interview questions
  • S-Shaped Matrix TraversalFox Corporation · PHONE SCREEN

Interview reports that mention this question

  • Google New Grad R1, Tic-Tac-Toe System: 1 Experience

Google interview experiences

  • Google interviews · November 2026
  • Google Software Engineer Onsite Questions: 10 Experiences
  • Google OA: What It Tests (2026)
  • Google L4 SWE Phone Screen: 1 Experience
  • Google ML Engineering Manager Onsite: 1 Experience
All Google interview questionsSee Google hiring insights
Saved
class Solution {
    public String[] getGameStatus(int k, int n, int[][] moves) {
        // write your code here
    }

}
Checking account…