Optiver interview question

Follow ups on hackerrank