Under pressue I'd probably use a Dictionary with the number as the key and the count as the value and build it as I looped through finding the mean.

I'm sure there are better ways to do it though.

And I'm generally against programming tests during an interview. I wouldn't be applying for the job if I didn't know how to program.