Line totals after a percentage discount
For each booking line item, compute the total after applying a percentage discount:
quantity × unit_price × (1 − discount_pct / 100)
Return item and line_total, rounded to 2 decimal places.
Schema
| id | INT |
| item | TEXT |
| quantity | INT |
| unit_price | NUMERIC |
| discount_pct | INT |
Example input
Stuck? Ask the coach for a nudge that won't give the answer away, or reveal the reference solution and a short walkthrough of why it works.
The interviewer's next question
Finance wants to see the discount itself, not just the discounted total: for each item, return item and discount_amount — how much money the discount actually saved, rounded to 2 decimals.
Solving follow-ups — the questions an interviewer actually asks next — unlocks with a Basic plan.
See Basic plansRM 25/mo · cancel anytime
Traveloka wants one number for the whole booking: return a single row with order_total, the sum of every line's discounted total, rounded to 2 decimals.
Solving follow-ups — the questions an interviewer actually asks next — unlocks with a Basic plan.
See Basic plansRM 25/mo · cancel anytime