← Stripe Interview Insights

Stripe·Software Engineer·Technical Phone Screen·Intermediate

Intermediate
Jun 2026

Summary

Stripe coding screen for a software engineer role. One meaty implementation question with a bunch of edge cases to talk through. The rate logic wasn't hard but keeping track of all the conditional branches got a little messy under pressure.

Questions Asked (1)

Q1

Implement a function that calculates shipping cost for an order given item weights, quantities, destination country, expedited flag, and an optional subtotal. Walk through how you'd handle the free-shipping threshold, international surcharge, and expedited multiplier, and discuss edge cases like an empty order, a single heavy item, a subtotal landing exactly on the threshold, and a multi-item international expedited order.

Algorithms & Data StructuresTechnical Trade-offs
Author's notes

The base logic came together fine but I kept second-guessing the order of operations.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements and defining the function signature, then break the problem into modular components: base cost, free-shipping threshold, international surcharge, and expedited multiplier. Walk through the logic with concrete examples, explicitly handling edge cases and discussing trade-offs like rounding and currency.

Pro tip: Mention that you'd use integer arithmetic for currency to avoid floating-point errors, and that you'd write unit tests for each edge case before finalizing the implementation.

1. Clarify Requirements and Assumptions

Ask about the base shipping rate, free-shipping threshold, international surcharge percentage, expedited multiplier, and whether subtotal includes tax or discounts. Confirm input types and expected output format.

2. Define Function Signature and Data Structures

Propose a function that takes a list of items (each with weight and quantity), destination country, expedited flag, and optional subtotal. Decide on return type (e.g., float or integer cents) and error handling.

3. Implement Core Logic Step-by-Step

Calculate total weight, compute base cost, apply free-shipping if subtotal meets threshold, add international surcharge if applicable, and apply expedited multiplier. Use clear variable names and modular helper functions.

4. Walk Through Edge Cases

Explicitly discuss empty order (return 0 or error), single heavy item (ensure no overflow, correct base cost), subtotal exactly on threshold (free shipping applies), and multi-item international expedited order (all rules combine correctly).

5. Discuss Trade-offs and Testing

Talk about rounding strategy, currency handling, and potential performance optimizations. Mention unit tests for each edge case and property-based testing for combinations.

Key Points to Mention

  • Use integer arithmetic (e.g., cents) to avoid floating-point precision issues.
  • Free-shipping threshold should be inclusive (>=) and based on subtotal after discounts if applicable.
  • International surcharge is typically a percentage of base cost, applied before expedited multiplier.
  • Expedited multiplier applies to the total cost after all other adjustments.
  • Empty order should return 0 or raise an error depending on business rules.
  • Validate inputs (e.g., negative weights, unknown country) and handle gracefully.

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