Employeur impliqué
Write a C# function to return the 3rd largest number from an unsorted array (without using a sort of built in function).
Utilisateur anonyme
I showed them a simple 1 liner using Linq OrderBy(), Skip() and Take() before doing an iterative approach with 3 loops. The first loop checked each number against a global max. The 2nd checked each number looking for something smaller than the global max found in loop 1 and stored in a 2nd max variable. The third loop did a similar thing while excluding the values which matched the previously found 1st and 2nd max values.