Dinner Selection

Requirements:

Serena and friends are trying to decide what to do for dinner. They wish to be egalitarian and will use plurality voting. Each member is allowed zero to three votes. Given two parameters, a list of people, and a list of their choices. Please find the dinner choice that has the most votes and return the number of people that voted for it.

Assumptions

  • people and foods are categorical (ie. names are capitalized, foods are lowercase)
  • there will be an equal number of elements in each list
  • no person will vote for the same item more than once
  • no person will vote more than three times
  • some people will abstain from voting
  • If there is no winner, then zero should be returned

Example 1:

There are three people, two with an overlap interest in cake. This food has been voted the most, with a value of two, and should be the return value.

Example 2:

One person has voted more than once, swaying the favor towards croissants (yum!)

Example 3:

Everyone has a strong and differing opinion on what they want to eat. No consensus is found, thus should return zero.

people:

foods:

Please try and complete this project before viewing the solution.