OOP coding problem: design functions, interfaces and classes around a domain scenario, then discuss optimization.
Asked in the hiring manager stage. Design a small, extensible event-routing model with an event class, a handler interface, concrete handlers, and a router. Events have an id and type; routes maps each event type to an ordered list of handler names. Support audit and alert handlers. Return outputs in event order and route order.
Implement route_events(events, routes), returning strings such as audit:12 or alert:12. Ignore event types without routes.
def route_events(events, routes):