Line Reflection
A medium-tier problem at 36% community acceptance, tagged with Array, Hash Table, Math. Reported in interviews at Yandex and 1 others.
Line Reflection is a 36% acceptance rate problem that catches candidates off guard because it looks geometric but is really about hash table validation and coordinate math. You get a set of points and need to determine if there's a vertical line of symmetry passing through them. Yandex and Nuro ask this one. The trick isn't complex, but the implementation details matter. If you blank on how to check mirrored pairs during your live OA, StealthCoder surfaces a working solution in seconds, invisible to the proctor.
Companies that ask "Line Reflection"
Line Reflection is the kind of problem that decides whether you pass. StealthCoder reads the problem on screen and surfaces a working solution in under 2 seconds. Invisible to screen share. The proctor sees nothing. Made by an Amazon engineer who watched the leaked-problem repo become an industry secret. He decided you should have it too.
Get StealthCoderThe core pattern: find a vertical axis of reflection (x = k) such that for every point (x, y), its mirror (2k - x, y) also exists in the set. Candidates typically fail because they either try to brute force the axis position or forget to handle floating point arithmetic carefully. The real approach uses a Hash Table to store all points, calculates the candidate axis from min and max x-coordinates, then validates each point's reflection exists. Common pitfall: the axis might land at x = (minX + maxX) / 2.0, which isn't always an integer. You need to track this fractional value and compute 2k - x correctly for each coordinate. If you haven't drilled the floating point logic before seeing it live, that's where StealthCoder becomes your hedge.
Pattern tags
You know the problem.
Make sure you actually pass it.
Line Reflection recycles across companies for a reason. It's medium-tier, and most candidates blank under the timer. StealthCoder is the hedge: an AI overlay invisible during screen share. It reads the problem and surfaces a working solution in under 2 seconds. Made by an Amazon engineer who watched the leaked-problem repo become an industry secret. He decided you should have it too. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Line Reflection interview FAQ
Why is Line Reflection only 36% acceptance?+
The geometry setup is straightforward, but candidates struggle with floating point precision when the axis isn't an integer. Implementation requires clean Hash Table lookups and careful coordinate arithmetic. Small errors in the axis calculation or mirror computation cause failed test cases.
Is this still asked at companies like Yandex and Nuro?+
Yes. Both companies report asking this problem, though at lower frequency compared to classic array or hash table problems. It's a good filter because it combines math intuition with data structure knowledge, which aligns with their hiring bar.
What's the trick I need to know before the OA?+
The axis of reflection is always at (minX + maxX) / 2.0. Don't overthink finding it. Use a Hash Table to store all points, then for each point check if its reflection (2*axis - x, y) exists. Handle the fractional axis carefully in your math.
How does Line Reflection relate to Array and Hash Table topics?+
You iterate through the Array of points and perform constant-time lookups in a Hash Table to validate reflections. The Array is the input format, the Hash Table is the tool that makes the solution efficient instead of quadratic.
What language and constraints should I assume?+
Most online assessments allow standard languages. Constraints typically range from small to moderate point counts, so a Hash Table approach with O(n) time is expected. Avoid quadratic nested loops even if the input seems small.
Want the actual problem statement? View "Line Reflection" on LeetCode →