Check Vertical Reflection Symmetry with Duplicate Points
Company: Nuro
Role: Software Engineer
Category: Coding & Algorithms
Difficulty: hard
Interview Round: Technical Screen
Overview: Determine whether a multiset of 2D points is symmetric across a vertical line, preserving duplicate counts and allowing half-integer axes.
Read the full Nuro Software Engineer interview experience this question came from
Constraints
- 0 <= len(points) <= 200000
- Every point contains exactly two integer coordinates.
- Each coordinate is in [-1000000000, 1000000000].
- Repeated points are allowed and their counts matter.
Examples
Input: ([],)
Expected Output: True
Explanation: The empty multiset is symmetric by definition.
Input: ([[5, -7]],)
Expected Output: True
Explanation: A single point lies on the line x = 5 and reflects to itself.
Hints
- For a nonempty input, ask how many different vertical lines could possibly be valid, and what the extreme points tell you about it.
- The line may sit at a half-integer; consider working with 2*c so everything stays an integer.
- Presence is not enough: compare how many times each point and its reflection occur.