Generalized M×N Tic-Tac-Toe with Win Length K

Asked at Databricks · Coding Questions · Difficulty: Medium · Last asked Oct 26, 2026

Build a two-player tic-tac-toe game on a rectangular board of any size, where the number of marks in a line needed to win is also a setting. Player 1 (shown as `X`) and Player 2 (shown as `O`) take turns; Player 1 moves first. Each move places a mark, prints the board, and reports whether that move won the game.

Loading the problem…