Leetcode 2013. Detect Squares
Design a data structure that supports adding points (duplicates allowed) and, for a given query point, counts how many triples of stored points together with the query form an axis-aligned square. The challenge is to efficiently enumerate and combine compatible partner points per query (coords 0–1000, ≤3000 total operations) rather than brute-forcing all triples.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
0
Hello Interview Premium
Your account is free and you can post anonymously if you choose.