Implement dasher active-time calculator

Quick Overview

This question evaluates competency in time-based event processing, pairing related events, computing durations using LocalDateTime and Duration APIs, and analyzing algorithmic time and space complexity.

Implement dasher active-time calculator

Company: DoorDash

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Technical Screen

Implement a function that, given a dasherId, a local pay-period interval [startLocalDateTime, endLocalDateTime), and a list of order events of the form {orderId, dasherId, type in {ACCEPT, FULFILL}, timestamp as LocalDateTime}, returns for each completed order in the interval the active duration between its ACCEPT and FULFILL and the total active duration across all completed orders. Assumptions: each completed order has exactly one ACCEPT before one FULFILL for the same dasher; events may be unsorted. Use LocalDateTime and Duration APIs. Explain the algorithm, its time and space complexity, and how you would adapt it to compute payment when pay rules are a function of active duration.

Quick Answer: This question evaluates competency in time-based event processing, pairing related events, computing durations using LocalDateTime and Duration APIs, and analyzing algorithmic time and space complexity.

|Home/Coding & Algorithms/DoorDash
DoorDash logo
DoorDash
Sep 6, 2025, 12:00 AM
mediumSoftware EngineerTechnical ScreenCoding & Algorithms
33
0

Implement a function that, given a dasherId, a local pay-period interval [startLocalDateTime, endLocalDateTime), and a list of order events of the form {orderId, dasherId, type in {ACCEPT, FULFILL}, timestamp as LocalDateTime}, returns for each completed order in the interval the active duration between its ACCEPT and FULFILL and the total active duration across all completed orders. Assumptions: each completed order has exactly one ACCEPT before one FULFILL for the same dasher; events may be unsorted. Use LocalDateTime and Duration APIs. Explain the algorithm, its time and space complexity, and how you would adapt it to compute payment when pay rules are a function of active duration.

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...