Practice Problem

Detect Squares

Difficulty: Medium

Design a data structure that supports adding points on a 2D plane and counting the number of ways to form axis-aligned squares with a given query point as one corner.