~learn.
0:00 / 1:13
LLD · Ride Sharing

You booked at no surge. Should you pay surge at drop-off?

transcript

You book a ride with no surge. Demand spikes while you sit in the car. Should your fare go up?

First, the plain fare. 50 rupees base. 10 kilometres at 12 rupees each: 120. 25 minutes at 2 a minute: 50 more. 220 rupees.

Surge doesn't edit that formula. It wraps it. It asks the tariff underneath for the fare. Then multiplies by the multiplier stored on the trip. Car, auto or bike tariffs never need to know surge exists.

But the formula isn't the hard part. When is. Compute surge at drop-off, and you pay for demand that came later. So it's computed once, when you book. Stored on the trip.

After a match, Neha books. 21 recent requests nearby. Only two free drivers. 21 over 2 is over ten times. Capped at two. 5 kilometres, 15 minutes: 140. Times two: 280. Locked in at booking.

Surge is a decorator, fixed on the trip when it's requested. A quote is a promise.

Full breakdown in the lecture.