Detect Squares
DetectSquares - add points and count squares add(point): Add point to data structure (duplicates allowed) count(point): Count squares where this point is one corner
Detect Squares is a classic scan-and-record problem: the right bookkeeping beats brute force. Interviewers love it because it reveals your data-structure instincts and your edge-case discipline. The classic trap is mishandling duplicates or overwriting useful information too early.

Meet Coco
Coco is an AI study partner, not a person. She listens while you explain your code, asks what a line does and never hands you the fix. Sign in free to type with Coco, up to a daily limit, and to talk with her for one hour. After that, talking comes with the $79 pack. Anyone can open the editor and run their code.