How the interviewer opens it
“Design a service that evaluates discounts and redeems coupons during purchases. It must enforce expiration dates, usage limits, and rules about which promotions can apply together.”
The prompt is vague on purpose. The first minutes are for you. Reduce the prompt to the core features and agree on the numbers before you draw.
What to clarify first
- Scale and traffic concentration
- Traffic mix and data size
- Eligibility and discount types
- Promotion combinations
- Usage limits
- Expiration and checkout
- Latency
- Consistency and durability
- Payment and policy changes
- Scope boundaries
The interviewer has the answers. In a SysRound round, Alex gives these answers, as a real interviewer does.
Scope of a strong answer
Core requirements
- Evaluate cart eligibility and calculate permitted discount combinations.
- Enforce expiration dates and global and per-customer usage limits.
- Reserve coupon capacity during checkout, then confirm or release it.
- Handle repeated requests and uncertain payment outcomes without duplicate coupon use.
Usually out of scope
- Build the payment provider.
- Build a promotion editor or customer segment service.
- Detect fraud or prevent customers from creating multiple accounts.
- Restore coupon capacity after refunds.
- Calculate shipping charges, tax, or currency conversion.
What interviewers ask about
- Coupon use limits
- Several purchases can compete for the last use across different codes. Each purchase can also consume several promotion limits at once.
- Discount decisions
- Eligible promotions can conflict or change each other's discount amounts. Cart changes and policy edits can invalidate an earlier result.
- Purchase completion
- Payment and coupon state change in separate systems. A timeout can leave capacity occupied without a known purchase outcome.
Common mistakes
- Treat an evaluation result as a guarantee that coupon capacity remains available.
- Check usage limits separately from the transaction that reserves capacity.
- Let different codes bypass the same promotion's customer limit.
- Expire unresolved payments and give their capacity to another purchase.
- Calculate discount combinations without a fixed application order or rounding policy.
- Choose distributed locks or database shards before measuring the stated load.
The bar by level
- Senior (L5/E5)
- Separate evaluation, reservation, and confirmation. Enforce all promotion limits in one transaction. Define money arithmetic, policy versions, and recovery after uncertain payment.
- Staff (L6+/E6+)
- State the invariants across checkout and payment. Resolve expiry races and delayed outcomes. Bound contention for popular promotions. Explain safe regional ownership or capacity allocation.