SquareBoat interview question

finding the max and second max element in an array