← Uber Interview Insights

Uber·Software Engineer·Technical Phone Screen·Intermediate

Intermediate
Jun 2026

Summary

Uber coding round for a software engineer role. The problem was a twist on the classic meeting rooms question, asking for per-interval room counts instead of just the peak. Felt manageable once I saw the pattern, but the output format tripped me up at first.

Questions Asked (1)

Q1

Given a list of meetings as [start, end) intervals, output the number of rooms simultaneously in use for each unit time interval or each distinct timestamp in a sweep line.

Algorithms & Data Structures
Author's notes

I recognized the meeting rooms problem pretty quickly but then stalled on what they actually wanted back.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Use a sweep line algorithm: create events for each meeting start (+1) and end (-1), sort them by time, then iterate through events while maintaining a running count of active rooms. At each distinct timestamp, record the count after processing all events at that time, ensuring that end events are processed before start events if intervals are half-open [start, end).

Pro tip: Clarify the interval semantics: since intervals are [start, end), a meeting ending at time t does not overlap with one starting at t, so process end events before start events at the same timestamp. Also, mention that this approach can be extended to find the maximum number of rooms needed.

1. Clarify the problem

Confirm that intervals are half-open [start, end), meaning a meeting ending at time t and another starting at t do not overlap. Ask whether the output should include timestamps with zero active meetings.

2. Create events

For each meeting, create two events: (start, +1) and (end, -1). Use a list or array to store these events.

3. Sort events

Sort the events by time. If two events have the same time, process end events (-1) before start events (+1) to respect the half-open interval semantics.

4. Sweep and count

Iterate through the sorted events, maintaining a running count of active rooms. At each distinct timestamp, after processing all events at that time, record the count.

5. Output results

Return the list of (timestamp, count) pairs or an array of counts for each unit time interval, depending on the requirement.

Key Points to Mention

  • Time complexity: O(n log n) due to sorting, where n is the number of meetings.
  • Space complexity: O(n) for storing events and output.
  • Handling of simultaneous events: process end events before start events for half-open intervals.
  • Edge cases: empty input, meetings with same start/end, overlapping intervals.
  • Alternative approach: using a min-heap to track end times, but sweep line is more direct for this output.
  • The algorithm can be easily adapted to find the maximum number of rooms needed.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.