Google L4 Onsite - Round 2

Difficulty: MEDIUMCategory: InterviewExperienceFrequency: 1Asked On 2025-06-09Added By Anonymous
Source: Link

Company: Google
Role: L4
Interview Stage: Onsite
Location: unknown
Year: unknown

Original Post Content:

Question
Given a set of points in a cartesian plane representing rectangles, find a vertical line defined by its x-coordinate which divides the plane into two halves of equal total areas.

NOTE:
Given rectangles cannot overlap with each other.
The vertical line should pass through the rectangles.

It was an open-ended question and things were expected to get clarified by asking questions. The interviewer didn't give any example, and I was the one supposed to come up with an example. It took 5-10 minutes even to understand the question. Then I explained a brute force and an optimized approach using binary search with sorting with O(NlogN) time complexity. Only the last 20 minutes were left to code, and the question was very implementation heavy. I wrote the code but missed a few edge cases, and time was up. I wish I could have understood the question fast enough to save enough time for coding at the end.

The question was of medium-hard level to solve in 35 minutes (as 10 minutes was reserved for intro and questions at the end). I am waiting for the feedback from the recruiter; it seems I might get H/LH.

Comments