Implement a Tic-Tac-Toe game class
Company: Microsoft
Role: Software Engineer
Category: Coding & Algorithms
Difficulty: medium
Interview Round: Technical Screen
Quick Answer: This question evaluates a candidate's competence in designing efficient stateful data structures and algorithmic optimization for an n×n game implementation, focusing on time-space trade-offs and robust API design.
Constraints
- Inputs are Python literals matching the function signature.
- Return a deterministic exact-match value.
Examples
Input: (3, [(0,0,1),(0,2,2),(1,1,1),(0,1,2),(2,2,1)])
Expected Output: [0, 0, 0, 0, 1]
Explanation: Player 1 wins diagonal.
Input: (2, [(0,1,2),(1,1,2)])
Expected Output: [0, 2]
Explanation: Player 2 wins column.
Input: (3, [])
Expected Output: []
Explanation: No moves.
Hints
- Choose a representation that makes the requested operation direct.
- Handle empty inputs and boundary cases first.