Faire tracks user activity as an event log while merchants move through an ordered product funnel, such as view_store, add_product, and request_order. Given the chronological events and the funnel steps, return how many unique users reached each step in sequence.
A user advances only when their event matches their next expected step. Duplicate events for a completed step are ignored, and an event for a later step cannot skip an earlier step. Events are already ordered chronologically.
Implement count_funnel_users(events, steps).
events is a list of dictionaries, each with a string user_id and a string step.steps is a list of distinct strings defining the funnel order.i is the number of unique users who reached steps[i] after completing every previous step.steps is empty, return an empty list.def count_funnel_users(events, steps):