Loading…
Loading…
What's different about a vending machine compared to most LLD problems: its behavior genuinely depends on what state it's currently in — inserting a coin means something different when idle vs. when a product is already selected. What pattern exists specifically for "behavior changes based on internal state, and state transitions should be explicit rather than a tangle of booleans and if-checks"?
Design your own solution first — on paper, a whiteboard, or your own IDE — before checking the reference.