Sanjaay Gowda T S
Alibaba Group Holding Limited practice

ORIGINAL COMPANY-CONTEXT PRACTICE

Compose marketplace promotions with explicit scope

Software engineeringHardConcept

Original practice scenario: A hypothetical marketplace combines seller discounts, platform vouchers and shipping offers in a basket with several sellers. Design a deterministic pricing calculation and explainable result.

Written for independent practice using company context; this is not a verified question from a company interview.

A REASONED APPROACH

Model answer.

Define promotion scope, ordering and rounding before implementing the calculator. Different rule orders can produce different totals even when each individual discount is calculated correctly.

Work through it

  1. Represent immutable basket lines with seller, currency, quantity and eligibility attributes, then classify promotions as line, seller-subtotal, basket or shipping rules.
  2. Apply a declared precedence and conflict policy, recording each rule's eligible base and allocated adjustment with exact monetary arithmetic.
  3. Return an itemized calculation trace and test thresholds, incompatible vouchers, partial returns and empty eligible populations, retaining the pricing rule version.

Tradeoffs to discuss

  • A flexible rule system supports varied campaigns but increases interaction complexity; restricting combinations makes results easier to explain.

Common pitfalls

  • Do not apply a seller-specific voucher to another seller's subtotal.
  • A return allocation must conserve the original charged amount rather than recompute a different current promotion.

KEEP PRACTISING

Related questions.

Keep learning beyond the interview.

Explore the Learning Hub