Today’s challenge
Build the solution
Write a function called parking_bill(minutes) for a parking garage.
Return contract: A dictionary with integer blocks and total_cents.
Input bounds: minutes is an integer from 0 to 10,000.
Keep the supplied driver below your implementation. It reads one JSON object and prints your return value as JSON. The driver may also probe the behaviour described above; those probe fields are part of the test input.
- The first 15 minutes are free. After that, every started 30-minute block is charged.
- The first four charged blocks cost 200 cents each. Each additional block costs 150 cents.
- Cap the amount due at 1,800 cents. Report the actual charged block count even when the cap applies.
The Twist: A stay of 45 minutes has one charged block; 46 minutes has two. Do not use floating-point rounding.
Sample
Input
{"minutes":46}Expected output
{"blocks":2,"total_cents":400}