About this question
Medium · data_structures · Quant Developer interview question · multimap, range-query, time-ordered, data_structures, event-window, iterator
Market surveillance and risk systems require efficient time-window queries on event streams, such as retrieving all trades within a specific millisecond interval. A sorted multimap, keyed by timestamp, provides logarithmic time complexity for range lookups, making it ideal for high-frequency data analysis. This pattern is crucial for calculating streaming P&L or attributing risk over rolling time windows. Task Implement an EventMap struct that uses a std::multimap<int, int> to manage timestamp-