Pregunta de entrevista de Crest Data Systems

Find the second largest element in an array?

Respuesta de la entrevista

Anónimo

27 feb 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.