Quant Memo
Coding/●●●●●

Do any two trades fall within t nanoseconds

You suspect a burst of near-simultaneous trades. Given unsorted trade timestamps and a tolerance t, decide whether any two timestamps are within t of each other.

timestamps = [100, 250, 130], t = 40
-> True          # 100 and 130 are 30 apart

Return True if some pair of timestamps differs by at most t, else False. Aim for O(nlogn)O(n \log n).

Your answer

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

More Coding questions