- Migratory Birds
Given an array of bird sightings where every element represents a bird type id, determine the id of the most frequently sighted type. If more than 1 type has been spotted that maximum amount, return the smallest of their ids.
There are two each of types and , and one sighting of type . Pick the lower of the two types seen twice: type .
Complete the migratoryBirds function in the editor below.
migratoryBirds has the following parameter(s):
- int arr[n]: the types of birds sighted
- int: the lowest type id of the most frequently sighted birds
The first line contains an integer, , the size of .
The second line describes as space-separated integers, each a type number of the bird sighted.
- It is guaranteed that each type is , , , , or .