Count Axis-Aligned Squares from Points (Optimize to O(n^2))

Count Axis-Aligned Squares from a Set of Points (Optimize to O(n^2))

You are given n distinct integer points points on a 2D plane, each as (x, y).

Count how many *axis-aligned squares...

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Standard Input
Execution Result: