Meeting Rooms
Reported by candidates from Goldman Sachs's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.
The mistake that sinks a first attempt on this one is treating touching meetings as a conflict. Goldman Sachs candidates reported Meeting Rooms in September 2026, and the half-open interval [start, end) is the whole catch. [7,10] and [10,12] are fine. It's an array problem with a sort in the middle, and it's short enough that one off-by-one decides it. If you blank on the comparison, StealthCoder runs invisibly during the live OA and can hand you the clean version. Know the trick first so you don't need it.
The problem
Each meeting is a half-open interval [start, end). Return true if one person can attend every meeting without overlap. Function canAttendMeetings(intervals: int[][]) → boolean Examples Example 1 intervals = [[0,30],[5,10],[15,20]] return = false The first meeting overlaps the others. Example 2 intervals = [[7,10],[10,12]] return = true Half-open intervals may touch at an endpoint. Constraints There are at most 10^5 intervals. start < end for every interval.
Reported by candidates. Source: FastPrep
Pattern and pitfall
Sort the intervals by start time. Then walk through once and compare each meeting's start to the previous meeting's end. If start < previousEnd, two meetings overlap and you return false. If you finish the loop, return true. The pitfall is using <= instead of <. Because intervals are half-open, start == previousEnd is legal, and Example 2 exists to punish the <= version. Another slip is skipping the sort and only comparing neighbors in the input order, which fails on Example 1 if the order is shuffled. With up to 10^5 intervals, an O(n^2) pairwise check is too slow, so sorting at O(n log n) is the intended answer. Handle the empty input by returning true. If you freeze mid-assessment, StealthCoder is the hedge, since it reads the problem on screen and gives you the solution without the proctor seeing it.
The honest play: practice the pattern, and have StealthCoder ready for the one you didn't see coming.
You can drill Meeting Rooms cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. Built for the candidate who saw this exact problem leak two days before his OA and wondered if anyone had a play.
Get StealthCoderRelated leaked OAs
This OA pattern shows up on LeetCode as meeting rooms. If you have time before the OA, drill that.
You've seen the question.
Make sure you actually pass Goldman Sachs's OA.
Goldman Sachs reuses patterns across OAs. Built for the candidate who saw this exact problem leak two days before his OA and wondered if anyone had a play. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Meeting Rooms FAQ
What's the trick in Goldman Sachs Meeting Rooms?+
Sort by start time, then check each meeting's start against the previous meeting's end. If start is less than the previous end, return false. The sort is what makes a single pass enough. Everything else is just getting the comparison operator right.
Why does [7,10] and [10,12] return true?+
The intervals are half-open, [start, end). The first meeting ends right before 10 and the second begins at 10, so they never share a moment. That means your overlap check must be strict: start < previousEnd, not start <= previousEnd.
Can I brute force it with 10^5 intervals?+
No. Comparing every pair is O(n^2), which is around 10^10 operations at the max size. Sort first, then do one linear pass. Total cost is O(n log n) time and little extra space beyond the sort.
How hard is this problem really?+
It's easy. The logic is about five lines. The risk is carelessness: the wrong comparison operator, forgetting to sort, or mishandling an empty list. Test both examples by hand before you submit and you're fine.
How do I prepare for this in 48 hours?+
Write the sort-and-scan solution from memory twice. Then trace Example 2 to confirm touching endpoints pass. Also be ready for the follow-up that asks for the minimum number of rooms, which uses a heap or a sweep over sorted start and end times.