← Airbnb Interview Insights

Airbnb·Software Engineer·Technical Phone Screen·Intermediate

IntermediatePrefer not to say
May 2026Remote

Summary

Airbnb software engineer interview with a coding round focused on game board design. The problem had a competitive twist that pushed beyond the usual tic-tac-toe variant most people prep for.

Questions Asked (1)

Q1

Design a data structure for a Connect-N game where pieces fall to the lowest empty cell in a column. Implement a move(column, player) function that returns true if the player has achieved N consecutive pieces in any direction after that move. What's your per-move time complexity and how does your algorithm work?

Algorithms & Data StructuresSystem DesignTechnical Trade-offs
Author's notes

My first instinct was to just scan the whole board after every move, which is obviously wrong for a senior-level question.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the game rules and constraints, then propose a board representation (e.g., 2D array with column heights) and a move function that places the piece and checks only the lines through the new piece. Explain the O(1) per-move time complexity by leveraging the fact that only the newly placed piece can create a winning line, and detail the directional checks.

Pro tip: Mention that you can optimize the win check by only examining the four lines (horizontal, vertical, and two diagonals) that pass through the newly placed piece, rather than scanning the entire board. This demonstrates awareness of efficiency and shows you understand the game's mechanics.

1. Clarify requirements and constraints

Ask about board dimensions, N value, number of players, and whether moves are always valid. Confirm that the board is fixed-size and pieces fall to the lowest empty cell.

2. Design data structure

Propose a 2D array (or list of lists) to represent the board, and an array of column heights to track the next available row in each column. This allows O(1) placement.

3. Implement move function

Place the piece at the next available row in the given column, update the column height, then check for a win by counting consecutive pieces in all four directions from the new piece.

4. Analyze time complexity

Explain that each move is O(1) because the win check examines at most 4 directions × 2 sides × (N-1) cells, which is constant for fixed N. Also note that board size does not affect per-move time.

5. Discuss trade-offs and edge cases

Mention handling of full columns, invalid moves, and potential optimizations like bitboards for small boards. Discuss space complexity O(rows × cols).

Key Points to Mention

  • Board representation: 2D array with column heights for O(1) placement.
  • Win check only around the newly placed piece in 4 directions (horizontal, vertical, two diagonals).
  • Per-move time complexity O(1) because N is constant and only a fixed number of cells are checked.
  • Space complexity O(rows × cols) for the board.
  • Edge cases: full column, invalid column index, and handling of N=1 or N larger than board dimensions.
  • Potential optimization: bitboards for compact representation and fast bitwise operations.

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