Trains the technique from
LeetCode 1275Find Winner on a Tic Tac Toe GameThis is an original problem, written from a brief that listed the technique, the difficulty, the topics, the function shape and the input bounds — none of that problem's wording, examples, hints or editorials. The link is there so you can map your practice onto the standard set.
Same function shape, different story and different numbers.
Two players take turns marking cells of a three-by-three board, the first player writing "A" and the second "B". The plays are given in order as moves, each [row, column], with the first entry being the first player's opening mark.
A player wins the moment they hold all three cells of any row, any column, or either of the two long diagonals, and the game stops there.
Return "A" or "B" for the winner, "Draw" when the board fills with no winner, or "Pending" when the game is unfinished.
Example 1
The first player takes the whole top row on their third mark, which wins.
Example 2
The first player's three marks run down the long diagonal from the top left.
Example 3
Only two marks have been made, so the game is still going.
The editor is preloaded with this. It matches the parent problem's shape, so a solution that works here transfers to a judge unchanged.
def tictactoe(moves: list[list[int]]) -> str:public String tictactoe(int[][] moves)See the step-by-step animation, the intuition, and clean code in every language — free, no credit card.