Given an array of integers (positive, negative, or 0), find the integer that occurs most
frequently in that array (you might remember this as the
mode from your middle school math class).
The set of numbers won't necessarily be in order. If there is more than one number that appears
most frequently, your algorithm should return nil
.
Here are some examples:
[1, 2, 1, 1,]
should return1
[1, 2, 3, 4]
should returnnil
[1, 1, 2, 3, 3]
should returnnil