{65, 70, 88, 70}, then the mode would be 70, since it
appears twice while all others appear once.
Sometimes, in the case of a tie, the mode will be more than one
number. For instance, if the scores were {88, 70, 65, 70,
88}, then the mode would be {70, 88}, since they
both appear most frequently.
You are given a int[] scores. You are to return a
int[]
representing the mode of the set of scores. In the case of more than one
number, they should be returned in increasing order.
scores will contain between 1 and 50 elements, inclusive.
scores will be between 0 and 100, inclusive.
{65, 70, 88, 70}
Returns: {70}
The first example from the problem statement.
{88, 70, 65, 70, 88}
Returns: {70, 88}
The second example from the problem statement.
{92, 56, 14, 73, 22, 38, 93, 45, 55}
Returns: {14, 22, 38, 45, 55, 56, 73, 92, 93 }
With no duplicates, all of the elements are the most frequent (appearing
once each).