SquareBoat Interview Question

Write code to find the largest element and second largest element in the given array.