Anonymous · shared experience1 Oct 2025 · 7 views
Stripe: Cheapest way to ship packages under weight and volume limits
Problem. A three-part shipping cost calculator.
- Part 1. You have packages with weights and ships that each have a weight limit and a fixed cost. Find the minimum total cost to ship every package. The candidate found that a greedy pass taking the heaviest packages first works here.
- Part 2. Each ship now also has a volume limit. Greedy stops working on some inputs; the candidate built a counterexample to show why before changing approach.
- Part 3. Several ship types with different cost structures, and both weight and volume constraints at once. The candidate used dynamic programming over the packages processed so far and the remaining weight and volume.
What the interviewer cared about. The Part 3 solution worked but was not optimal, and the interviewer nudged toward compressing the DP state. The candidate's own takeaways were to notice early when an approach will not scale, keep code readable as requirements grow, handle edge cases without being prompted, and explain complexity clearly.
Comments 0
No comments yet. Ask the author something, or add what happened in your own round.