Count the intersection points between infinite vertical lines and rectangles.
Unlock detailed company stats for this questionUpgrade
Given n vertical lines of infinite length in an XY plane and m rectangles, a line that cuts through a rectangle makes two intersection points (one with the upper horizontal edge, one with the lower). If a line aligns with or overlaps a vertical side of a rectangle, it is not counted as an intersection. Find the total number of intersection points in efficient time and space. A binary search hint was given.
Format · Whiteboard round at Uber's Bengaluru office.
Community answers
No answers contributed by the community yet.
Related questions
Count the magical rectangles formed by a set of unique 2D points.Related courses

Course

Course
Course
