Stripe: Apply ordered commands to entities with valid state transitions only
Problem. Simulate a system that holds several kinds of entities. You receive an ordered list of commands. Each command tries to move some object from one state to another. Apply the update only when the transition is allowed; if it is not, ignore the command completely, with no side effects. After all commands are processed, produce an aggregated final result.
Format. One main problem, 60 minutes, for a new-grad role. The candidate kept the exact wording abstract, but rated it hard because it is heavy on logic rather than math, closer to backend business rules than a classic algorithms puzzle.
What was evaluated.
- Picking data structures that give fast lookups by id.
- Managing state cleanly.
- Reading the requirements carefully.
- Defensive handling of edge cases and invalid operations.
- Modular, production-style code, finished on time.
Approach the candidate used. Clear models for entities and states, maps keyed by entity, strict checking of allowed transitions, and processing commands strictly in order.
Comments 0
No comments yet. Ask the author something, or add what happened in your own round.