Let an object change its behavior when its internal state changes, by delegating to a state object rather than a pile of if/switch statements — a traffic light that cycles Red → Green → Yellow → Red.
Implement `RedState`/`GreenState`/`YellowState`, each returning the NEXT state object from next().
solve(transitions) starts at Red and calls next() that many times, returning the full sequence of state names visited (including the starting state).
solve(1) → ['Red', 'Green']
Sample tests