Optiver interview question

HackerRank test, given 48 hours