~learn.
0:00 / 1:16
LLD · Hotel Reservation

Same room, same Monday: why the fourth guest pays ₹750 more

transcript

Same room type, same Monday. The fourth guest pays 750 rupees more. Fair enough. But the third guest nearly paid it too.

This hotel prices each night alone, through a chain of rules. Friday and Saturday nights: plus 20 percent. Three quarters of the type taken that night: plus 25 percent. Seven nights or more: 10 percent off. Each rule takes the price so far.

Four standard rooms, one Monday. The first two guests pay 3,000. The third guest: also 3,000. The fourth: 3,750. Three of four were taken. Surge.

But here's the catch. The third guest's own hold made it three of four. The quote runs before the room is taken. No surge on yourself.

Ravi books the suite for seven nights. Base 9,000. Ten percent off: 8,100. Friday and Saturday add the weekend rule too: 9,720. Each night priced on its own. Total: 59,940.

And the hold fixes each night's price. You pay what you saw. A new rule, like a festival rate? Just a new class in the chain.

Full breakdown in the lecture.