Fewest Shared Pickup Points Covering Every Rider's Walking Range

Last updated: November 29, 2026

Quick Overview

Each rider in a shared ride request can walk to any point within an interval [left, right] on a street. Choose the fewest pickup points so that every rider's interval contains at least one point, and return the points chosen.

Uber
Coding & Algorithms
Software Engineer
Uber
November 29, 2026
Software Engineer
Technical Screen
Coding & Algorithms
Medium

0

0

0 solved


Each rider in a shared ride request can walk to any point within an interval [left, right] on a street. Choose the fewest pickup points so that every rider's interval contains at least one point, and return the points chosen.

This reflects UberX Share and Express Pool, where riders walk a short distance to a common pickup spot. The interviewer is checking the sort-by-right-end greedy and a proof that placing a point at the earliest right end is safe.

What the Interviewer Expects
  • Sorts intervals by right endpoint
  • Places a point at the right end of the first uncovered interval
  • Skips intervals already containing the last point
  • Proves optimality with a stays-ahead argument
  • Returns the actual points, not just the count
Key Topics to Cover
Greedy
Interval scheduling
Sorting
Interval stabbing
How to Approach This
  1. Clarify input constraints and edge cases before writing code.
  2. Walk through your approach verbally and confirm with the interviewer before coding.
  3. Start with a brute force solution, then optimize. Mention time and space complexity.
  4. Test your solution with examples, including edge cases like empty input or duplicates.
  5. Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
  • What if each pickup point can serve at most c riders?
  • What if pickup points must be chosen from a fixed list of legal curb spots?
  • How would this extend to a 2D map with walking radius?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice DSA Problems
Sample Answer
Requirements

Input: list of [left, right] with left <= right, integer coordinates. Output: a sorted list of points of minimum size such that every interval contains one. Endpoints are inclusive....

High-Level Design

Sort intervals by right end. Keep the last chosen point, initially negative infinity. For each interval, if its left end is greater than the last point, the interval is uncovered, so choose its right ...


Submit Your Answer
Markdown supported