Answer: NEC CORPORATION Hiring | Off-Campus OA (2023) | Tic Tac Toe Game
Answer · Posted Jun 2026
Approach Simulate the Tic Tac Toe game on a 3 × 3 board. Represent Player A with 1. Represent Player B with -1. After every move, check whether the current player has completed: Any row Any column Main diagonal Secondary diagonal If a player wins, return immediately. After all moves: If all 9 moves are played, return "Draw". Otherwise return "Pending". Strategy Create a 3 × 3 board initialized with zeros. Alternate between Player A (1) and Player B (-1). ...
The full answer & interview discussion are available to premium members.
Log in Create a free account