Domanda di colloquio di Tesla

Very easy algorithm question and react question.