Design a data structure that can add points on a 2D plane (duplicates allowed) and, given a query point, count the number of axis-aligned squares that can be formed with the query as one corner and three previously added points as the others.
add([3,10]); add([11,2]); add([3,2]); count([11,10])1Solve it in the editor. Sign in free to run your Python or JavaScript against test cases, get a verdict, and track your attempts.
Solve on FeatCode →A grab-bag of problems solved with numeric or coordinate reasoning rather than a specific data structure — matrix manipulation, simulation, and basic number theory.
Read the full Math & Geometry guide →
Original problem on LeetCode ↗