Write a method LeastCommon
that accepts a Dictionary
whose keys are strings and whose values are integers as a parameter and returns the integer value that occurs the fewest times in the dictionary.
For example, if a dictionary named m
contains {{"Alyssa", 22}, {"Char", 25}, {"Dan", 25}, {"Jeff", 20}, {"Kasey", 20}, {"Kim", 20}, {"Mogran", 25}, {"Ryan", 25}, {"Stef", 22}}
, the call of LeastCommon(m)
returns 22
.
If there is a tie, return the smaller integer value.
If the dictionary is empty, throw an ArgumentException
.