dots on a plane, each given as a pair [x, y]. Some points may coincide.
Decide whether there is a vertical line (parallel to the Y axis) that the set of points is symmetric about: reflecting every point across that line gives back exactly the same set of points.
Return True if such a line exists and False otherwise. Try to do better than comparing every pair of points.dots=[[2, 5], [6, 5], [4, 1]] → True
Take the line x = 4: (2, 5) and (6, 5) swap places, and (4, 1) lies on the line itself.
dots=[[0, 0], [2, 1]] → False
The points are at different heights, so no vertical line can map one onto the other.
dots=[[3, 7], [3, 7], [1, 2], [5, 2]] → True
Repeated points are fine: the line x = 3 works.
dots=[[2, 5], [6, 5], [4, 1]]
True
Run checks the first 3 tests in your browser. Submit checks all 141 tests on the server, hidden ones included.