Product
Pricing
Blog
Forum
NEW
Referral
Description
Solution
Discussion
Submissions
Ask AI
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
Report
Report seen similar question in interview
Ask AI Assistant
Ask AI Assistant
Ask me anything about this coding question!
python
Auto
Debug
Run
Submit
Test Cases
Input
Output
Expected