def count_games() -> int:
The round: a Decagon coding question in five reports from April to October 2026: three phone screens (one for an AI engineer role) and two onsite coding rounds. The phone screens ask for the 3x3 count. One onsite asked for the same count on a 4x4 board with three in a row; another onsite candidate solved it by brute force and then added memoisation. Two graded parts.
Part 1 — every game on the 3x3 board
def count_games() -> int:
255168.9! = 362880, an upper bound, since many games end early.Notes: the 3x3 statement, its answer, the 9! estimate, the 4x4 three-in-a-row variant and the memoisation step are reported. The function names, the general rows, cols, k signature, the 4x4 rules beyond the board size and three in a row, the 4x4 answer (we computed it; no report gives one) and all the Part 2 test boards are ours.
Five reports from April to October 2026. Three are phone screens: one for an AI engineer role that the candidate notes is not on LeetCode as such, one as the second phone round, and one where the candidate did not finish debugging and was rejected the next day. Two are onsite coding rounds: one solved it by brute force and then added memoisation, and one got the 4x4 board with three in a row. One interviewer asked for an estimate before any code; the candidate gave 9! as an upper bound. A candidate who got stuck on the backtracking for a while finished it and was still rejected, and thought being slow to produce the backtracking may have counted against them.
Common mistakes: Placing marks after a win, which counts games that never happened.; Counting final boards instead of move sequences.; Running plain backtracking on the 4x4 variant, which has about 1.3 trillion games (our count).
What candidates did: One estimated the size first with 9! as an upper bound, then wrote the standard backtracking. One wrote brute force and then added memoisation. Two who were rejected say they got stuck debugging or were slow to produce the backtracking, so practise writing it cleanly and quickly.
Also reported as Tic Tac Toe
The round: a Decagon coding question in five reports from April to October 2026: three phone screens (one for an AI engineer role) and two onsite coding rounds. The phone screens ask for the 3x3 count. One onsite asked for the same count on a 4x4 board with three in a row; another onsite candidate solved it by brute force and then added memoisation. Two graded parts.
Part 1 — every game on the 3x3 board
def count_games() -> int:
255168.9! = 362880, an upper bound, since many games end early.Part 2 — a bigger board, k in a row
def count_games_board(rows: int, cols: int, k: int) -> int:
rows x cols board where k in a row wins, along a row, a column or either diagonal. The game still ends at the first win or a full board.1281016086768 (about 1.3 trillion games, our computation), so walking the games one by one cannot finish; memoising on the position can (about 3.5 million positions, our count).Notes: the 3x3 statement, its answer, the 9! estimate, the 4x4 three-in-a-row variant and the memoisation step are reported. The function names, the general rows, cols, k signature, the 4x4 rules beyond the board size and three in a row, the 4x4 answer (we computed it; no report gives one) and all the Part 2 test boards are ours.
Before coding, estimate the order of magnitude of the answer.
Add memoisation to the brute force.
Count all possible games on a 4x4 board where three in a row wins.
Common mistakes: Placing marks after a win, which counts games that never happened.; Counting final boards instead of move sequences.; Running plain backtracking on the 4x4 variant, which has about 1.3 trillion games (our count).
What candidates did: One estimated the size first with 9! as an upper bound, then wrote the standard backtracking. One wrote brute force and then added memoisation. Two who were rejected say they got stuck debugging or were slow to produce the backtracking, so practise writing it cleanly and quickly.
If you have had this round, tell us how close this page was. It is how we keep the pages accurate.
Send them this page. It is free to read, no account needed.
What you just read — canonical solution, follow-up arc, what passing candidates actually did — exists for all 8 Decagon questions, refreshed monthly from new candidate reports.