They told you upfront it would be something like this, so you really have no excuse not to prep a few of these.
Start by clarifying the scope and constraints with the interviewer, then outline a minimal viable architecture before coding. Focus on demonstrating clean code, separation of concerns, and making deliberate trade-offs between speed and quality. Prioritize a working core game loop over polish, and communicate your decisions throughout.
Pro tip: Treat the 45 minutes as a collaborative design session, not a solo coding sprint. Verbally explain your thought process and ask for feedback at key decision points to show you value alignment and iteration.
Ask questions to understand the expected platform (iOS/Android), UI complexity, and whether the game should be playable or just a prototype. Confirm the time budget and what 'done' means for this exercise.
Sketch a simple architecture: separate game logic from UI, define a state model (e.g., board array, current player), and identify key components (GameEngine, ViewController/Composable). Mention how you'll handle win conditions and turn switching.
Code the game rules (move validation, win detection, draw) in a testable, UI-agnostic way. This ensures correctness and allows you to demonstrate unit-testability even if you don't write tests.
Create a basic grid UI with tappable cells and a status label. Connect it to the game logic, handling user input and updating the view. Keep the UI simple to save time.
Walk through the code, test edge cases (e.g., winning move, draw), and discuss what you'd improve with more time (e.g., animations, AI opponent, persistence). Highlight trade-offs made due to time constraints.
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.