We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
The id of birds vary from 1 to 5. Since, count is 0-indexed, setting size as 6 allows to have indices 0 to 5. Out of these, we use 1 to 5 for corresponding ids of birds.
If multiple birds have equal occurences, say 34, then max(count) returns 34. The "index" method applied on count (count.index(34) for this case) will return the smallest id.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Migratory Birds
You are viewing a single comment's thread. Return to all comments →
The id of birds vary from 1 to 5. Since, count is 0-indexed, setting size as 6 allows to have indices 0 to 5. Out of these, we use 1 to 5 for corresponding ids of birds.
If multiple birds have equal occurences, say 34, then max(count) returns 34. The "index" method applied on count (count.index(34) for this case) will return the smallest id.