Loading problem…
Implement a minimal Redux-like createStore(reducer, initialState).
This is a common frontend interview problem because it tests state ownership, reducer-driven updates, subscriptions, and snapshot semantics without requiring React.
Return an object with:
getState()dispatch(action)subscribe(listener)dispatch should call the reducer with current state and action.dispatch should return the action.subscribe registers a listener and returns an unsubscribe function.