QA InfoTech Interview Question

code on ide most optimized apporach to find second maximum in an array