Count of rectangles that can be formed with stream of points

Правка en2, от abhi55, 2021-07-13 22:04:28

This question was asked in an online screening test. Any clue how to solve it with Online Approach better than O(N^3)?

My Approach:

Maintain two maps of Map<X, Set> and Map<Y, Set> and for each point find horizontal and vertical points and for every triplet check 4th point exist or not.

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский abhi55 2021-07-13 22:04:28 187
en1 Английский abhi55 2021-07-13 22:01:12 292 Initial revision (published)