Reported October 2026
Ripplingheap priority queue

Delivery Cost Tracker

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

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

Rippling's Delivery Cost Tracker, reported in October 2026, looks like a design question but it's really integer arithmetic plus one running total. Parse rates into cents, never floats, and every operation turns into adding or subtracting from two numbers. The follow-ups about paying deliveries up to a timestamp and tracking active drivers are where people stumble. If you blank on the bookkeeping during the live OA, StealthCoder sits invisible on your screen as a safety net. The core idea is small. You just have to see it fast.

The problem

Build a cost tracker for delivery drivers. Each driver has a fixed hourly rate, and every recorded delivery contributes to the company's total delivery cost.
Operation Format
Process the rows of operations in order. Return one string for every query operation, in query order.
["ADD_DRIVER", driverId, hourlyRate]: Add a driver whose hourly rate is a decimal USD string with at most two fractional digits. Driver IDs are unique.
["RECORD_DELIVERY", driverId, startTime, endTime]: Record a delivery interval using integer Unix timestamps in seconds. The driver exists, startTime < endTime, and the interval lasts at most three hours.
["GET_TOTAL_COST"]: Return the total cost of all recorded deliveries.
["PAY_UP_TO", payTime]: Mark every delivery with endTime <= payTime as paid.
["GET_UNPAID_COST"]: Return the total cost of all currently unpaid deliveries.
Cost Rules
A delivery's cost is hourlyRate * (endTime - startTime) / 3600.
Overlapping deliveries are paid independently, even when they belong to the same driver.
Format every returned cost with exactly two digits after the decimal point.
Every judged delivery produces an exact cent value, so no additional rounding rule is needed.
Interviewer follow-ups
Reports describe the task growing in stages: first maintain total cost, then support paying all completed deliveries up to a timestamp and querying unpaid cost. A later follow-up asks for the maximum number of simultaneously active drivers during the previous 24 hours. Interviewers also emphasized exact decimal handling for financial values.

Function
trackDeliveryCosts(operations: String[][]) → String[]

Examples
Example 1
operations = [["ADD_DRIVER","alice","10.00"],["RECORD_DELIVERY","alice","0","5400"],["GET_TOTAL_COST"],["GET_UNPAID_COST"],["PAY_UP_TO","5400"],["GET_UNPAID_COST"]]
return = ["15.00","15.00","0.00"]
A 90-minute delivery at $10 per hour costs $15. It remains unpaid until PAY_UP_TO 5400.
Example 2
operations = [["ADD_DRIVER","a","18.00"],["ADD_DRIVER","b","24.00"],["RECORD_DELIVERY","a","100","1300"],["RECORD_DELIVERY","b","500","2300"],["GET_TOTAL_COST"],["PAY_UP_TO","1500"],["GET_UNPAID_COST"]]
return = ["18.00","12.00"]
The overlapping deliveries cost $6 and $12 independently. Only the first has ended by timestamp 1500.

Constraints
1 <= operations.length <= 100000
Timestamps are integer seconds.
Every judged delivery cost is an exact number of cents.

Reported by candidates. Source: FastPrep

Pattern and pitfall

Here's what it reduces to. Store each rate as integer cents. A delivery's cost in cents is rateCents * (end - start) / 3600, and the problem guarantees that's exact, so integer division is safe. Keep total and unpaid as integers. RECORD_DELIVERY adds to both. For PAY_UP_TO, you need every unpaid delivery with endTime <= payTime. Since payTime can come in any order relative to records, keep deliveries in a min-heap keyed by endTime, pop while top <= payTime, and subtract their cost from unpaid. Each delivery is popped once, so it's O(n log n) overall. Pitfall: using floats or doubles for money, then printing 14.999999. Format output by dividing cents by 100 and padding the remainder to two digits. Another trap is re-paying a delivery. The heap pop handles that. If the 24-hour active-drivers follow-up appears and you stall, StealthCoder is your hedge. Think sweep line or a sorted event list.

StealthCoder is the hedge for the one pattern you didn't drill. It runs invisibly during the screen share.

If this hits your live OA

You can drill Delivery Cost Tracker 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. If you're reading this with an OA window open, you're who this was built for.

Get StealthCoder

Related leaked OAs

⏵ The honest play

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

Rippling reuses patterns across OAs. If you're reading this with an OA window open, you're who this was built for. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Delivery Cost Tracker FAQ

What's the trick in the Rippling Delivery Cost Tracker?+

Convert every hourly rate to integer cents on ADD_DRIVER, then keep two integer totals, total and unpaid. Cost per delivery is rateCents * duration / 3600, which is guaranteed exact. Formatting is just cents divided by 100 with a two-digit remainder. No floats anywhere.

How do I handle PAY_UP_TO efficiently?+

Push each delivery into a min-heap ordered by endTime, storing its cost in cents. On PAY_UP_TO, pop while the top's endTime is at most payTime and subtract each cost from the unpaid total. Every delivery leaves the heap once, so the work stays near O(n log n).

Why not just use doubles for the money?+

Floating point can't represent most decimal cents exactly, so sums drift and you print values like 14.99 instead of 15.00. The interviewers reportedly stressed exact decimal handling. Parse the string into integer cents, do all math on integers, and only format at output time.

What about the follow-up on simultaneously active drivers in the past 24 hours?+

Treat each delivery as a start event plus and an end event minus, restricted to the 24-hour window. Sort the events and sweep, tracking the running count of distinct active drivers. Watch overlapping deliveries from the same driver, so count per-driver active intervals, not raw deliveries.

How should I prepare in 48 hours for this kind of question?+

Write the base version cold: parse cents, track two totals, add the heap for payments. Then rehearse formatting cents to a string with padding. Practice the sweep-line idea once for the follow-up. This is a stateful simulation problem, so clean structure beats clever algorithms.

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

OA at Rippling?
Invisible during screen share
Get it