Tic-Tac-Toe Board Status
Reported by candidates from Pinecone's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.
Pinecone reportedly put a tic-tac-toe status check in front of candidates in October 2026, and the twist is the board isn't 3x3. It's n x n, up to 500. The statement hands you the exact rule: a win means filling an entire row, column, main diagonal, or anti-diagonal. You return "X", "O", "Tie", or "Playing". It's a simulation and counting problem, not a hard one, and the traps are all in the edges. If you blank on the diagonal indexing during the live assessment, StealthCoder is the invisible hedge that gives you a working solution.
The problem
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" X fills the first row. Example 2 board = ["XO.","OX.","X.."] return = "Playing" No complete line exists and empty cells remain. Example 3 board = ["XOX","XXO","OXO"] return = "Tie" 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.
Reported by candidates. Source: FastPrep
Pattern and pitfall
The trick is one pass over the grid. Keep counters for each row, each column, and both diagonals, per player. Or skip counters and just check each line for all-same non-empty characters. Either way it's O(n^2) time, which is fine for n = 500. Track whether any '.' exists as you scan. Then the order is simple: if X has a full line return X, if O has one return O, if no empty cell remains return Tie, else Playing. The constraints guarantee a valid board with at most one winner, so you don't need to handle both winning. The common pitfall is the anti-diagonal. The cell is (i, n-1-i), and people off-by-one it. Another is returning Tie before checking for a winner on a full board. Example 3 is full and has no winner, but a full board can still be a win. StealthCoder is there if the live OA scrambles your index logic.
Memorize the pattern. If you can't, run StealthCoder. The proctor sees the IDE. They don't see what's behind it.
You can drill Tic-Tac-Toe Board Status cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. Made by an engineer who treats the OA as theater. If yours is tonight, you don't have time to grind. You have time to hedge.
Get StealthCoderRelated leaked OAs
This OA pattern shows up on LeetCode as find winner on a tic tac toe game. If you have time before the OA, drill that.
You've seen the question.
Make sure you actually pass Pinecone's OA.
Pinecone reuses patterns across OAs. Made by an engineer who treats the OA as theater. If yours is tonight, you don't have time to grind. You have time to hedge. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Tic-Tac-Toe Board Status FAQ
How hard is the Pinecone tic-tac-toe status question really?+
Easy to medium. The logic is simple, but the board is n x n, so hardcoding 3x3 lines fails. Expect the difficulty to be in clean generalization and edge cases like n = 1, not in any advanced algorithm.
What's the trick to checking every line?+
Loop i from 0 to n-1 and check row i, column i, then the two diagonals with cells (i,i) and (i,n-1-i). Count X and O per line, and a line wins when its count equals n. One pass, no repeated work.
What order should I return the results in?+
Check winners first, then the empty cells. If X has a full line return X, if O has one return O. Only then return Tie when no '.' remains, otherwise Playing. A full board can still contain a win, so Tie must come last.
What about n = 1?+
A single cell is a row, a column, and both diagonals at once. If it's X or O, that player wins. If it's '.', the board is Playing. Your general loop handles this naturally as long as you don't special-case 3x3.
How do I prepare for this in 48 hours?+
Write the n x n version from scratch twice, with and without counters. Test on the three given examples plus a full board with an anti-diagonal win and a 1x1 board. That covers nearly every bug this problem can throw at you.