Your question is Deduplicate Events Preserving First Order. 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.
Given a list of customer event IDs events in arrival order, return a new list containing only the first occurrence of each event ID. If the same ID appears again later as a late-arriving duplicate, it should be ignored. The output must preserve the order of the first time each distinct event ID appeared.
def deduplicate_events(events):