← Snowflake Interview Insights

Snowflake·Software Engineer·Technical Phone Screen·Intermediate

IntermediatePrefer not to say
Apr 2026

Summary

Snowflake SWE interview with a tic-tac-toe board validation problem. Trickier than it looks on the surface because of all the edge cases around turn counts and the 'stop after win' rule. Decent problem overall, felt like it was testing whether you actually think through state machines rather than just coding the obvious.

Questions Asked (1)

Q1

Given a 3x3 tic-tac-toe board represented as an array of 3 strings, write a function that returns the game status: whether the board is invalid, X wins, O wins, a draw, X's turn, or O's turn.

Algorithms & Data StructuresTechnical Trade-offs
Author's notes

I started with the easy stuff, count X's and O's, check that X has either the same count as O or one more.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

First, validate the board by counting X's and O's and checking for impossible win configurations. Then determine the game status by checking for wins, draws, or whose turn it is based on the counts.

Pro tip: Clarify the rules upfront: assume X always goes first, and a valid board must have either equal counts or one more X than O. Also, both players cannot win simultaneously.

1. Count X's and O's

Count the number of X and O marks on the board to determine if the counts are valid. Valid counts are either X == O or X == O + 1.

2. Check for wins

Check all rows, columns, and diagonals to see if X or O has three in a row. Record if X wins and/or O wins.

3. Validate board consistency

If both X and O win, the board is invalid. If X wins, then X must have one more mark than O. If O wins, then X and O must have equal marks. Otherwise, the board is invalid.

4. Determine game status

If the board is valid and X wins, return 'X wins'. If O wins, return 'O wins'. If no wins and the board is full, return 'Draw'. Otherwise, return 'X's turn' if counts are equal, else 'O's turn'.

Key Points to Mention

  • Count validation: X == O or X == O + 1
  • Win condition checks for rows, columns, and diagonals
  • Mutual exclusivity of wins: both cannot win
  • Win-count consistency: X wins => X == O + 1; O wins => X == O
  • Draw condition: board full and no winner
  • Turn determination based on counts

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.