Katkat

Specify the Lowest Price Across Percentage and Buy-X-Get-Y Discounts

InstacartSoftware Engineer · Onsite

Last updated

Clarify percentage and buy-x-get-y pricing rules, then reason about the cheapest legal discount combination, quantity thresholds, interactions, and rounding.

Design a price-calculation procedure that takes transaction records and available discounts, then returns the most favorable permitted price. Discounts include percentage reductions and buy-x-get-y offers.

Constraints

The transaction schema, offer eligibility, stacking rules, repeated-use limits, free-item selection, and rounding policy are unspecified. Clarify them before claiming a unique minimum price. This is a conditional pricing-algorithm discussion, with no invented fixed policy or executable console contract.

Clarifying Questions

  • Does buy x get y mean y additional units are free, and can the offer repeat?
  • Which items qualify, and which items become free if prices differ?
  • Can percentage and quantity offers stack, and in what order?
  • Is the best price chosen per line, per product, or for the whole transaction?
  • At which stage are amounts rounded to the smallest currency unit?

Hints

Hint 1

Define what makes two offers compatible: Choosing the cheapest option independently for each item is valid only when eligibility and usage constraints do not couple the choices.

Follow-up questions

  • What changes if a promotion can be used only once across the whole basket?
  • How would you explain which offer produced the selected price?