10 September 2026
First Reopen Order
Medium
Dictionaries
Lists
Find the order in which support tickets were reopened for the first time.
A helpdesk logs every time an agent works on a ticket. You are given a list of ticket IDs, in the order those events happened. Find the moment each ticket is worked on for the second time — its first reopen. Return the ticket IDs in the order those first reopens happened. A ticket that is only ever worked on once does not appear in the result. Any time after the second does not count again.
Constraints
events has between 0 and 500 entrieseach ticket_id has between 1 and 20 characters
Function signature
def first_reopen_order(events):