FastPrepIs This Tic-Tac-Toe Board Reachable
Problems/Is This Tic-Tac-Toe Board Reachable

Is This Tic-Tac-Toe Board Reachable

Adobe logoAdobe● MediumFULLTIMEPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: You decide whether a 3 x 3 tic-tac-toe position could come up in a real game, when we know which player moves first. An Adobe MTS 2 report from Noida (October 2024, covering interviews from July to September) lists checking a board for validity as the third question of its first problem-solving round. The candidate wrote it in C++ and says reading the input took real effort. The interviewer later noted that the candidate had not asked who moves first while collecting the requirements. The report gives no board format, game rules or examples.

We chose these rules. The board is three strings of X, O and dots. The starting player is an input. A game stops as soon as someone has three in a line. We wrote new examples.

Our version is about 75% the same as the reported question.

Two players, X and O, play tic-tac-toe on a 3 x 3 board. They take turns, and on each turn a player puts one of their own marks on an empty cell. The player named by first makes the first move. The game ends as soon as one player has three of their marks in a row, a column or a diagonal; nobody moves after that. It also ends when the board is full.

The board is given as three strings, one per row from top to bottom. Each character is 'X', 'O' or '.', where '.' is an empty cell.

Return true if this board can appear at some moment of such a game (the empty board before the first move counts), and false otherwise.

Function

isReachable(board: String[], first: String) → boolean

Examples

Example 1

board = ["X.O",".X.","..."]first = "X"return = true
board
0120X.O1.X.2...

X has 2 marks and O has 1, and nobody has three in a row. X moved, then O, then X: this board can happen.

Example 2

board = ["X.O",".X.","..."]first = "O"return = false
board
0120X.O1.X.2...

The same board, but now O moves first. Then O always has as many marks as X or one more, never fewer. Here O has 1 and X has 2, so the board cannot happen.

Example 3

board = ["XXX","OO.","..O"]first = "X"return = false
board
0120XXX1OO.2..O

X completed the top row with its third mark. The game ends at that moment, so O could not have placed a third mark afterwards. With 3 marks each, O must have moved after X won: impossible.

Constraints

  • board.length == 3 and board[i].length == 3
  • Each board[i][j] is 'X', 'O' or '.'
  • first is "X" or "O"

Interview reports that mention this question

  • Adobe SWE Interviews, Level Unknown: 25 Experiences (Part 2 of 3)
  • Adobe Interviews, Level Unknown: 38 Experiences (Part 1 of 3)
  • Adobe MTS Interview Questions: 12 Experiences (Part 2 of 6)
  • Adobe Experienced Hire Interviews: 55 Experiences (Part 1 of 6)

Adobe interview experiences

  • Adobe Web, QA, DevOps, ML Roles: 13 Experiences (Part 3 of 3)
  • Adobe New Grad MTS Interview Questions: 7 Experiences
See Adobe hiring insights
Saved
class Solution {
    public boolean isReachable(String[] board, String first) {
        // Write your code here.
    }
}
Checking account…