Design Connect-N winner detector

Quick Overview

This question evaluates data structure design and algorithmic optimization for grid-based game state management, including spatial reasoning required to detect n-in-a-row after a move.

Design Connect-N winner detector

Company: Airbnb

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Technical Screen

##### Question Design a data structure for the Connect-N game: pieces are dropped into a column (occupying the lowest empty cell). Implement move(column, player) that returns true if, after the move, the player has n consecutive pieces horizontally, vertically, or diagonally. Optimize the per-move time complexity and explain the algorithm. https://leetcode.com/problems/find-winner-on-a-tic-tac-toe-game/description/

Quick Answer: This question evaluates data structure design and algorithmic optimization for grid-based game state management, including spatial reasoning required to detect n-in-a-row after a move.

|Home/Coding & Algorithms/Airbnb
Airbnb logo
Airbnb
Jul 29, 2025, 8:05 AM
mediumSoftware EngineerTechnical ScreenCoding & Algorithms
22
0
Question

Design a data structure for the Connect-N game: pieces are dropped into a column (occupying the lowest empty cell). Implement move(column, player) that returns true if, after the move, the player has n consecutive pieces horizontally, vertically, or diagonally. Optimize the per-move time complexity and explain the algorithm.

https://leetcode.com/problems/find-winner-on-a-tic-tac-toe-game/description/

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...