Optiver Interview Question

three codings: one simulation, one dp.