← Uber Interview Insights

Uber·Software Engineer·Technical Phone Screen·Intermediate

IntermediatePrefer not to say
Apr 2026Remote

Summary

Uber SWE coding round, pretty much one meaty interval problem with a follow-up that I wasn't fully ready for. The main question was fine but the memory constraint angle at the end is where things got interesting.

Questions Asked (1)

Q1

Given two sorted, pairwise-disjoint lists of closed intervals, find all intersections between the two lists. Follow-up: how would you handle this if the lists are too large to fit in memory?

Algorithms & Data StructuresTechnical Trade-offs
Author's notes

Two-pointer sweep wasn't hard to get to, the intersection formula is just max of starts and min of ends, check that max <= min and you're done.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Use a two-pointer technique to traverse both sorted lists, comparing intervals and advancing the pointer with the smaller end point. For the follow-up, discuss external sorting or streaming with chunked processing to handle memory constraints.

Pro tip: Clarify interval representation (inclusive/exclusive) and edge cases like touching intervals before coding; this shows attention to detail and prevents off-by-one errors.

1. Clarify assumptions and edge cases

Confirm interval definition (closed, inclusive), sorted order, and disjointness. Discuss edge cases like empty lists, single intervals, and touching intervals.

2. Design two-pointer algorithm

Initialize pointers at the start of each list. While both pointers are valid, compute intersection if intervals overlap, then advance the pointer with the smaller end value.

3. Analyze complexity and correctness

Explain O(m+n) time and O(1) extra space. Argue correctness by invariant: pointers only advance past intervals that cannot intersect future intervals.

4. Address memory constraints

For large lists, propose external sorting or streaming: read chunks, merge-sort on disk, then apply two-pointer with buffered I/O. Alternatively, use a distributed approach if data is sharded.

5. Discuss trade-offs and optimizations

Compare in-memory vs. external approaches. Mention binary search for skewed sizes, and consider parallel processing for independent chunks.

Key Points to Mention

  • Two-pointer technique for O(m+n) time complexity
  • Handling of edge cases: empty lists, no intersections, touching intervals
  • Correctness proof via loop invariant
  • External sorting or streaming for out-of-core processing
  • Trade-offs between in-memory and external algorithms
  • Potential optimizations like binary search for unbalanced list sizes

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