PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep
|Home/Coding & Algorithms/Decagon

Design a Tic-Tac-Toe Engine

Last updated: Jun 19, 2026

Quick Overview

This question evaluates algorithm design and data structure competency, emphasizing state representation, time-space trade-offs, and techniques for achieving constant-time updates in a two-player n×n Tic-Tac-Toe engine.

  • medium
  • Decagon
  • Coding & Algorithms
  • Software Engineer

Design a Tic-Tac-Toe Engine

Company: Decagon

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Technical Screen

Implement an `n x n` Tic-Tac-Toe game engine for two players. Support a method `move(row, col, player)` that records a move and returns whether that move causes the player to win. Discuss two versions: 1. A straightforward implementation that stores the full board and checks rows, columns, and diagonals after each move. 2. An optimized implementation that avoids storing the entire board and updates the winner status in constant time per move. Assume all moves are valid and no move is made after the game has already been won.

Quick Answer: This question evaluates algorithm design and data structure competency, emphasizing state representation, time-space trade-offs, and techniques for achieving constant-time updates in a two-player n×n Tic-Tac-Toe engine.

Related Interview Questions

  • Implement a Recipe Cart - Decagon (medium)
  • Implement a CSAT Sliding Window Tracker - Decagon (easy)
  • Enumerate 4x4 Tic-Tac-Toe Games - Decagon (medium)
  • Design rolling-window conversation score tracker - Decagon (easy)
  • Compute exclusive CPU time from nested logs - Decagon (medium)
Decagon logo
Decagon
Feb 17, 2026, 12:00 AM
Software Engineer
Technical Screen
Coding & Algorithms
13
0
Practice Read
Loading...

Implement an n x n Tic-Tac-Toe game engine for two players. Support a method move(row, col, player) that records a move and returns whether that move causes the player to win.

Discuss two versions:

  1. A straightforward implementation that stores the full board and checks rows, columns, and diagonals after each move.
  2. An optimized implementation that avoids storing the entire board and updates the winner status in constant time per move.

Assume all moves are valid and no move is made after the game has already been won.

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Decagon•More Software Engineer•Decagon Software Engineer•Decagon Coding & Algorithms•Software Engineer Coding & Algorithms
PracHub

Master your tech interviews with 8,000+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.