Valid Tic-Tac-Toe State
Solve this the way you would in the interview: out loud, on a timer, with an AI interviewer asking follow-ups while you code. You get a scored report at the end.
Practice this as a mock interviewFree to start, no account neededProblem
You are given a 3 x 3 tic-tac-toe board as a list of three strings board, where each character is 'X', 'O', or ' ' (an empty square).
A game starts on an empty board. Players alternate placing their mark on an empty square, with 'X' always moving first. The game stops immediately once one player has three marks in a row, column, or diagonal, or once the board is full; no more moves are made after that.
Return true if board could appear at some point during a legal game, and false otherwise.
Examples
Constraints
- `board.length == 3`
- `board[i].length == 3`
- `board[i][j]` is `'X'`, `'O'`, or `' '`
What the interviewer grades
A correct solution is one of five scores. The report also grades problem understanding (did you clarify inputs and edge cases before coding), problem solving, communication while you work, code quality, and testing. See a sample report, or read up on the pattern in the lessons.