← DoorDash Interview Insights

DoorDash·Software Engineer·Technical Phone Screen·Intermediate

IntermediatePrefer not to say
Jun 2026Remote

Summary

DoorDash software engineer coding round, one meaty question about building a checkout price calculator. Felt like a reasonable problem but the edge cases pile up fast and I definitely underestimated the promotion logic at first.

Questions Asked (1)

Q1

Implement a checkout price calculator for a shopping cart that applies at most one promotion from a list, where promotions are either a percentage discount on item subtotal or a fixed-amount discount on the full total including shipping. Return the minimum payable amount and which promotion was chosen.

Algorithms & Data StructuresTechnical Trade-offs
Author's notes

I spent way too long on the happy path and almost forgot the clamping to zero requirement until they nudged me.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Clarify the requirements and edge cases, then design a modular solution that computes the base total (subtotal + shipping) and evaluates each promotion independently, selecting the one that yields the minimum payable amount. Implement the calculation with clear separation of concerns and test with various scenarios including no promotions and ties.

Pro tip: Discuss how you would handle ties (e.g., multiple promotions yielding the same minimum) and whether to prioritize percentage or fixed discounts; also mention the importance of validating inputs and handling floating-point precision.

1. Clarify Requirements

Ask questions to confirm details: Are promotions applied to subtotal or total? Is shipping always included? Can promotions be combined? What if multiple promotions yield the same minimum?

2. Design Data Model

Define classes or structures for Cart, Promotion (with type and value), and a function to compute the payable amount for a given promotion.

3. Implement Calculation

Compute the base total (subtotal + shipping). For each promotion, apply it according to its type and compute the resulting payable amount. Track the minimum and the corresponding promotion.

4. Handle Edge Cases

Consider empty cart, no promotions, promotions that exceed the total (clamp to zero), and floating-point rounding issues.

5. Test and Validate

Write unit tests covering normal cases, edge cases, and ties. Verify that the correct promotion is selected and the amount is accurate.

Key Points to Mention

  • Modular design: separate promotion logic from cart calculation for extensibility.
  • Time complexity: O(n) where n is number of promotions, as each is evaluated once.
  • Handling ties: define a deterministic rule (e.g., first promotion in list or prefer percentage).
  • Floating-point precision: use integer cents or round appropriately to avoid errors.
  • Input validation: ensure cart items and promotions are valid (e.g., non-negative values).
  • Extensibility: how to add new promotion types without modifying core logic (e.g., strategy pattern).

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.