Optiver Interview Question

Design a data structure/algorithm to keep track of instruments, stock exchanges, and trades which supports an addInstrument, addTrade and getAllTradesBetweenTimes(time1, time2) operation.

Interview Answers

Anonymous

Nov 17, 2019

Do you have additional information? I was thinking there could be an overarching class called 'market', which has a vector of all trades, and a vector of all exchanges. Each function just modifies the arrays in some way(add, delete, etc.) and to get all trades between two times, we can just do a linear or binary search for the two times and return another vector of the trades. I am implementing all of this in C++. Is this the type of thing that is expected?

2

Anonymous

Nov 17, 2019

Are there any issues of concurrency or parallelization that arise in this scenario? It seems that's what they expect us to be challenged with, but I do not see any real issues here that can't be solved with just a few mutexes/

Anonymous

Sep 22, 2019

Need for information. For example, what is the relation between instruments, stock exchanges, and trades?