Domanda di colloquio di Optiver

there were two hackkerrank coding questions.