Algorithm · Square · Medium
In a game with n players, every player holds some number of animals of each of several animal types. Each animal type forms its own scoring category: within a category, players are ranked by how many animals of that type they hold, the top-ranked player receives n points, the next receives one point fewer, and so on down to 1 point for the player in last place. A player's overall total is the sum of the points they earned across all categories. Examples Example 1 Example 2…