Pergunta da entrevista

Entrevista para IOS Developer

-Karlsruhe, Baden-Wurttemberg

Citrix

Write a program to find second largest no in given array.

Resposta

Respostas da entrevista

2 respostas

0

How about sorting the array and move 2 indices from the last item and get the value. This way, we can extend the solution to finding the k-th largest element in an array.

Pradeep em

0

In an unsorted array whenever you set the largest number during iteration, you set second largest number to previous largest number.

Ihtesham Khan em

Adicionar respostas ou comentários

Para comentar sobre isso, entre na conta ou cadastre-se.