Your question is Hash Map and Set Program. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
The Airtel Thanks app records successful feature events as they occur. Given an event stream and a list of required features, return the subscriber ID of the first subscriber who has successfully used every required feature. Duplicate events for the same subscriber and feature should count only once.
Use a hash map to associate each subscriber with a set of features they have used. Return None if no subscriber completes the required feature set.
Implement first_complete_subscriber(events, required_features).
events is a list of two-element lists [subscriber_id, feature], processed in order.required_features is a list of distinct feature names.subscriber_id and feature are strings.None if completion never occurs.required_features is empty, return None.def first_complete_subscriber(events, required_features):