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.