InterviewLegend

Intervals and Binary Search

Alex Chen40 min readUpdated 86 real interview reports

Intervals come second only to graph search among Lyft coding questions. The Multi-Source BFS & Scheduling lesson solves its scheduling problem with a heap, but none of the four problems here needs one.

Two of them are a sort followed by a single sweep. One is two calls to a single binary-search helper. The last works differently, because you binary search on the answer itself.

All four turn on a boundary. Do two ranges that touch at one point overlap? Is there a gap between two neighbouring positions? Settle the rule out loud before you code, then run the case that sits right on it.

Every solution below runs in six languages. One of them can overflow a 32-bit integer on its largest inputs, so run that case once in Java or C++.

LyftPremium lesson · Coding round

The 4 Lyft problems are below.

  1. A Premium questionCoding · Medium
  2. A Premium questionCoding · Medium
  3. A Premium questionCoding · Medium

+ 1 more in this lesson

Each with hints, the follow-up and a tested solution.

Get the Lyft questions

$49 a year · all 100 companies · cancel anytime

From 20,000+ candidate reports, forum threads behind logins and write-ups in Chinese.

Had your Lyft interview?Tell us what they asked. Reviewed before it goes in, never with your name.
Lyft interview guide

Know what Lyft asks before you walk in.

28 coding · 2 system design · 12 behavioral questions

Get Premium$49 a year · Cancel anytime
Or start freeNo card.

Get their questions first.

InterviewLegend is independent and not affiliated with or endorsed by any company it covers.