Code RoomInvoice split and tax spec
HardPrep Room Coding #4153

Invoice split and tax spec

Vibe & agenticAlgorithms & data structuresSenior–Staff~20 min

You're asking an AI agent to implement a Java function that splits an invoice total across N line items proportionally and applies a percentage tax, returning amounts to charge a customer's card. Write the spec that makes it monetarily correct and auditable. What numeric type, rounding mode, and invariants do you require, and what acceptance criteria prove it? Then describe what a naive prompt ('split the total and add tax') produces that fails an accountant's audit.

Implement
split_invoice_with_tax(total_cents: int, weights: list[int], tax_basis_points: int) → list[int]
Examples
in[10000,[1,1,1],0]out[3334,3333,3333]
in[10000,[1,1,1],825]out[3609,3608,3608]
What a strong answer looks like

Treat the AI’s output as a draft to verify, not an answer to trust. Name the specific flaw and the input that triggers it, say how you’d catch it (tests, edge cases, reading critically), and how you’d re-prompt or decompose to get it right.

0:00 of about 20 min

Vibe & agentic: describe the solution in plain language (or narrate it) and the coach grades your approach.

Which questions mattered is sealed until you submit. Telling you now would just be handing over the edge cases.