logo CodeStepByStep logo

HasDuplicateValue

Language/Type: C# Dictionary collections

Write a method named HasDuplicateValue that accepts a SortedDictionary from strings to strings as a parameter and returns true if any two keys map to the same value. For example, if a dictionary named m stores {{"Marty", "Stepp"}, {"Stuart", "Reges"}, {"Jessica", "Miller"}, {"Amanda", "Camp"}, {"Meghan", "Miller"}, {"Hal", "Perkins"}}, the call of HasDuplicateValue(m) would return true because both "Jessica" and "Meghan" map to the value "Miller". Return false if passed an empty or one-element map. Do not modify the dictionary passed in.

Method: Write a C# method as described, not a complete program or class.

You must log in before you can solve this problem.

Log In

Need help?

Stuck on an exercise? Contact your TA or instructor.

If something seems wrong with our site, please

Is there a problem? Contact us.