employer cover photo
employer logo
employer logo

Crest Data Systems

Is this your company?

Crest Data Systems Interview Question

Find the second largest element in an array?

Interview Answer

Anonymous

Feb 27, 2024

Keep largest and secondLargest iterate over the array and whenever you find an element greater than largest update secondLargest to largest and largest to current element or if the element is smaller than largest but greater than secondLargest simply update secondLargest to current element.