10

Performance Competition: Find least frequent number in a list

K Bonneau 3/29/2015 12:31 PM

Given a list of numbers (IList<int>) containing arbitrary numbers, find a number in the list with the least number of occurrences.

If the list is null or empty return null

If there are more than one numbers with the same least number of occurrences, returning any of the numbers is valid.

e.g. In the list below, the number 8 occurs only once while all other numbers occur more than once. Hence the result is 8

10 |
15 |
10 |
15 |
9 |
6 |
9 |
8 |
6 |
9 |