Implement a simple service with tests
DoorDashSoftware Engineer · OnsiteLast updated
Implement a simple service with tests evaluates algorithm design, data structures, correctness, complexity, edge cases, and implementation details in a realistic interview setting. A strong answer states assumptions, handles edge cases, explains trade-offs, and shows how to validate the result clearly.
You're given a short written specification for a small service class (no external dependencies). Implement the class using clear control flow (primarily if/else) and robust input validation. The exercise has three parts: (
- implement the core logic; (
- extend it with an additional requirement based on clarified assumptions; (
- write unit tests that cover happy paths, edge cases, and error handling for both parts. State all assumptions explicitly and provide method signatures and representative test cases.
Solution walkthrough is for members
Get the full walkthrough with reference code and complexity analysis, plus Kitty Coach at 300 messages a day. Hints, the code runner and community answers stay free.