Optiver Interview Question

there were two hackkerrank coding questions.