Learn State Pattern — a key concept for LLD interviews.
Interactive — Try it yourself!
How to use
1Select "State" tab — see a vending machine in IDLE state
2Click "Insert Coin" — state changes to HAS_MONEY
3Click "Select Item" → DISPENSING → item drops → back to IDLE
4Notice: only valid buttons are enabled per state!
In a nutshell
State Pattern lets an object change behavior when its internal state changes. Like a vending machine — different actions available depending on whether you've inserted money or not.