Pergunta de entrevista da empresa Crest Data Systems

Find the second largest element in an array?

Resposta da entrevista

Sigiloso

27 de fev. de 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.