Design a Driver Earnings Tracker with Incremental Payment Processing
Design a system to track delivery drivers and compute their earnings based on hourly rates and trip durations. Implement APIs to add drivers, record trips, calculate total costs, process payments up to a given timestamp, and retrieve pending unpaid amounts.
Asked at:
Rippling
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
Mid May, 2026
Rippling
Mid-level
Early April, 2026
Rippling
Senior
Problem Overview: You are asked to design a system to track delivery drivers and compute their earnings. Initial APIs: addDriver(driverId, hourlyRate) recordTrip(driverId, startTime, endTime) getTotalCost() Details: Each driver has an hourly rate. Trips are defined by (startTime, endTime). Cost = duration * hourlyRate. Time precision is at least seconds, so you may need to convert to hours. Follow-up (this is where it gets interesting): The interviewer then extends the problem: payUpTo(time) Pay all completed trips up to a given timestamp getTotalPendingCost() Return remaining unpaid amount Key Challenges: This is NOT a typical DSA problem. It’s more like a mini backend system design implemented in code. Things that matter: Handling time intervals correctly Trips relative to payment cutoff Avoid double counting Incremental computation Avoid recomputing everything repeatedly Track what has already been paid Data modeling Drivers Trips Payment state Precision Converting seconds to hours Handling money (floating point vs exact values) Similar LeetCode Problems (closest analogies): This problem doesn’t map directly to a single LeetCode problem, but these are somewhat related: 981 Time Based Key-Value Store (querying state over time) 362 Design Hit Counter (time-window aggregation) 729 / 732. My Calendar I / III (interval handling) 146 LRU Cache (incremental state management)
Hello Interview Premium
Your account is free and you can post anonymously if you choose.