Quant Memo
Coding/●●●●●

First repeated order ID in a stream

Order IDs stream in and should be unique, but a bug occasionally re-sends one. Return the first ID that appears for a second time, in stream order. If every ID is unique, return None.

order_ids = [3, 1, 4, 1, 5]
-> 1            # the second 1 is the first repeat seen

Return the first ID seen twice, else None. Aim for O(n)O(n).

Your answer

This one is open-ended. Work it through, then check your reasoning against the full solution.

More Coding questions