Pergunta de entrevista da empresa SquareBoat

finding the max and second max element in an array