Optiver interview question

there were two hackkerrank coding questions.