Google | Onsite | Check if a point is "lower than" another point

Given 2 sets of points S1, S2 in D-dimensional space, how do I efficiently check if there exists a point pair (a,b) where a is from S1 and b is from S2, such that every coordinate of a is <= every corresponding coordinate of b?

Can you solve this efficiently for D=2?
Follow up: Can you solve this efficiently for D>=2 in general?

I have been struggling to find an algorithm more efficient than the O(n^2 * D) brute-force algorithm which checks every pair (n is the number of elements in S1 and S2).

Comments (6)