New
ML System Design & SQL tracks just landed
See what's new
×
Question Bank
Pricing
Blog
Forum
HOT
Referral
Description
Solution
Discussion
Submissions
Ask AI
Question Bank
Google
Coding Question
AI Insights
Quick Summary
Simulate a turn-based game where players draw lines between adjacent grid points
Detect when a new move completes a 1x1 square and identify the current player
Return the winning player number or 0 if the game ends without any completed square
What This Tests
Stateful simulation and turn management
Coordinate normalization and geometric reasoning
Constant-time lookup using hash sets
Optimizing naive grid scanning by focusing on local candidates
Common Patterns
Simulation
Hashing
Collapse
Hint 1
Hint 2
What Interviewers May Ask Next
Ask AI Assistant
Ask AI Assistant
Ask me anything about this coding question!
Qwen
Qwen3.6-Flash
0/2000
Auto
Debug
Run
Submit
Test Cases
Input
Output
Expected