Maximize Dasher Earnings From Non-Overlapping Delivery Offers
Last updated: November 29, 2026
Quick Overview
Given delivery offers as (start, end, pay), choose a set of non-overlapping offers that maximizes total pay, where an offer ending at time t is compatible with one starting at t.
DoorDash
November 29, 20260
0
0 solved
Given delivery offers as (start, end, pay), choose a set of non-overlapping offers that maximizes total pay, where an offer ending at time t is compatible with one starting at t.
A one-dimensional DP question grounded in the Dasher side of the marketplace: which offers should a Dasher accept during a shift to earn the most? The interviewer expects weighted interval scheduling with binary search, and a clear explanation of why greedy by pay or by end time fails.
What the Interviewer Expects
- Show a counterexample where greedy fails
- Sort offers by end time
- Define dp over prefixes of the sorted offers
- Use binary search to find the last compatible offer
- Explain the reconstruction of chosen offers
Key Topics to Cover
How to Approach This
- Clarify input constraints and edge cases before writing code.
- Walk through your approach verbally and confirm with the interviewer before coding.
- Start with a brute force solution, then optimize. Mention time and space complexity.
- Test your solution with examples, including edge cases like empty input or duplicates.
- Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
- How would you return the actual offers chosen?
- What if travel time between the end of one offer and the start of the next depends on location?
- What if a Dasher can hold two offers at once?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
- Input: list of
(start, end, pay)withstart < end. - Chosen offers must not overlap; touching endpoints are fine.
- Output: maximum total pay (0 if no offers)....
High-Level Design
Sort by end time. Let dp[i] be the best pay using only the first i offers. For offer i (1-based), either skip it (dp[i-1]) or take it plus the best among offers that end at or before its start. ...