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

Tic-Tac-Toe Board Status

Pinecone logoPinecone● EasyFULLTIMEOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in a Pinecone online assessment. The report gives the board symbols and the four result states we need. It does not give the exact labels, the limits, or the rules for a valid board. Our version is about 94% the same as the reported question.

Given a valid n x n tic-tac-toe board encoded as an array of strings, return its current status.

Each cell is X, O, or . for empty. A player wins by filling an entire row, column, main diagonal, or anti-diagonal.

  • Return "X" if X has won.
  • Return "O" if O has won.
  • Return "Tie" if every cell is occupied and neither player won.
  • Return "Playing" otherwise.

Function

ticTacToeStatus(board: String[]) → String

Examples

Example 1

board = ["XXX","O.O","..O"]return = "X"
board
0120XXX1O.O2..O

X fills the first row.

Example 2

board = ["XO.","OX.","X.."]return = "Playing"
board
0120XO.1OX.2X..

No complete line exists and empty cells remain.

Example 3

board = ["XOX","XXO","OXO"]return = "Tie"
board
0120XOX1XXO2OXO

The board is full and neither player has a complete line.

Constraints

  • 1 <= n <= 500.
  • Every row has length n and contains only X, O, and ..
  • The board is a valid reachable game state with at most one winner.

More Pinecone Online Assessment questions

  • Binary Tree Right ViewOA · Seen Feb 2024
  • Minimum Binary String Length After Pair RemovalsOA · Seen Feb 2024
  • Set Matrix ZeroesOA · Seen Feb 2024

Similar questions at other companies

  • Wind-Blown Leaves Remaining in a GridAbridge · OAAbridge interview questions
  • Trapped Characters in a GridAdobe · OAAdobe interview questions
  • Count Pieces After Othello MovesHudson River Trading · OAHudson River Trading interview questions
  • Robot Navigation Around LasersRoblox · OARoblox interview questions
  • Apply a Reversi MoveAmazon · OA
  • First Completed Mingo LineEpic · OAEpic interview questions
  • Rotate a Square Matrix ClockwiseVisa · OAVisa interview questions
  • Sort Concentric Matrix Borders ClockwiseByteDance · OAByteDance interview questions
  • Sparse Valid Conv2D From ScratchNVIDIA · OANVIDIA interview questions
  • Apply Matrix OperationsCapital One · OACapital One interview questions
See Pinecone hiring insights
Saved
class Solution {
    public String ticTacToeStatus(String[] board) {
        // Write your code here.
    }
}
Checking account…