Reported September 2026
DoorDashsimulation

Dasher Active Time

Reported by candidates from DoorDash's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.

Get StealthCoderRuns invisibly during the live DoorDash OA. Under 2s to a working solution.
Founder's read

DoorDash reported this one in September 2026, and it looks friendlier than it is. Up to 100000 events sit in two parallel arrays, and you need the total minutes where at least one delivery is live. If you're taking this OA in the next day or two, the pattern is a single-pass counter sweep. StealthCoder is the safety net on the live assessment if your mind goes blank, but you can handle this one by reading the examples carefully. The trick is that overlapping deliveries don't stack, so you only care whether the count is above zero, not how high it is.

The problem

A Dasher processes an ordered sequence of delivery events during one day. The arrays timestamps and actions have equal length. Event i occurs at minute timestamps[i] from the start of the day, and actions[i] is either PICKUP or DROPOFF.
A pickup adds one active delivery. A dropoff completes one active delivery. The sequence is valid: no prefix has more dropoffs than pickups, and every pickup is matched by the final event.
The Dasher is active whenever at least one delivery is active. Overlapping deliveries do not multiply active time. Return the total number of minutes during which the Dasher is active. If there are no events, return 0.
Timestamps are nondecreasing and each timestamp is between minute 0 and minute 1440, inclusive. When several events have the same timestamp, process them in their given order; because no time passes between them, their order does not itself add active minutes.

Function
totalActiveTime(timestamps: int[], actions: String[]) → int

Examples
Example 1
timestamps = [510,550,620,735,765,865]
actions = ["PICKUP","DROPOFF","PICKUP","PICKUP","DROPOFF","DROPOFF"]
return = 285
The active ranges are [510,550) and [620,865). Their lengths are 40 and 245, for 285 active minutes. The overlapping deliveries from minute 735 through 765 still contribute time only once.
Example 2
timestamps = [0,5,10,20]
actions = ["PICKUP","PICKUP","DROPOFF","DROPOFF"]
return = 20
The active-delivery count stays positive from minute 0 until minute 20, so the total is 20.
Example 3
timestamps = [10,10,20,20]
actions = ["PICKUP","DROPOFF","PICKUP","DROPOFF"]
return = 0
Each delivery is picked up and dropped off at the same minute, so neither lifecycle contains a positive-length active interval.

Constraints
0 <= timestamps.length <= 100000.
actions.length = timestamps.length.
0 <= timestamps[i] <= 1440.
timestamps is in nondecreasing order.
Every action is PICKUP or DROPOFF.
In every prefix, the number of dropoffs is at most the number of pickups.
The total number of pickups equals the total number of dropoffs.

Reported by candidates. Source: FastPrep

Pattern and pitfall

Walk the events in order and keep an active count. Before applying each event, if the count is greater than zero, add timestamps[i] minus the previous timestamp to the total. Then apply the event: PICKUP adds one, DROPOFF subtracts one. Update the previous timestamp. That's O(n) time and O(1) space. Brute force that simulates every minute works only because the day is 1440 minutes, but looping over events per minute gets ugly fast with 100000 events, so don't. The common pitfall is adding time after the update instead of before, which breaks Example 3 where events share a timestamp and the answer must be 0. Same-timestamp events add zero gap, so their order never adds minutes. Another slip is counting deliveries instead of checking count > 0, which gives 20 times the overlap in Example 2. If you freeze on the live OA, StealthCoder can hand you this sweep, but the logic is short enough to own.

Memorize the pattern. If you can't, run StealthCoder. The proctor sees the IDE. They don't see what's behind it.

If this hits your live OA

You can drill Dasher Active Time cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. Made by an engineer who treats the OA as theater. If yours is tonight, you don't have time to grind. You have time to hedge.

Get StealthCoder

Related leaked OAs

⏵ The honest play

You've seen the question. Make sure you actually pass DoorDash's OA.

DoorDash reuses patterns across OAs. Made by an engineer who treats the OA as theater. If yours is tonight, you don't have time to grind. You have time to hedge. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Dasher Active Time FAQ

How hard is the DoorDash Dasher Active Time question really?+

Easy to medium. It's a single pass with a counter. The difficulty is in the details: summing gaps only while the count is positive, and handling events that share a timestamp. If you trace Example 3 by hand, you'll catch the main bug.

What's the trick to Dasher Active Time?+

Track an active count and the previous timestamp. Before processing each event, if the count is above zero, add the time gap since the last event. Then update the count. Overlaps take care of themselves because you only test for positive, not the count's size.

Do I need to sort or use a heap?+

No. Timestamps are already nondecreasing and events are given in processing order. Sorting would be wasted work and could scramble same-minute events. A linear scan handles up to 100000 events easily.

How do I handle events at the same timestamp?+

The gap between them is zero, so they add nothing no matter the order. Process them in the given order and keep the count right. In Example 3, each pickup and dropoff pair lands at the same minute, so the total stays 0.

How do I prepare for this in 48 hours?+

Write the sweep from scratch twice and run all three examples by hand. Then test an empty input, one pair at the same minute, and nested overlaps. That covers the edge cases this problem is built around. Similar interval and counter problems are worth a quick look too.

Problem reported by candidates from a real Online Assessment. Sourced from a publicly-available candidate-aggregated repository. Not affiliated with DoorDash.

OA at DoorDash?
Invisible during screen share
Get it