How do you implement MVVM in an Android app, and why would you choose it?
For the hands-on portion, implement the ViewModel state-reduction logic that an Android UI observes. Write reduce_view_state(initial_items, events) to process ordered event maps and return the final state map. Each state contains status, items, and error; preserve cached items during loading and errors, replace them on success, and clear errors on recovery.
def reduce_view_state(initial_items, events):