You are viewing a single comment's thread. Return to all comments →
C# solution
public static int migratoryBirds(List<int> arr) { var birdsDict = new Dictionary<int, int>(); for(var i = 0; i < arr.Count; i++){ if(birdsDict.ContainsKey(arr[i])){ birdsDict[arr[i]] ++; continue; } birdsDict.Add(arr[i], 1); } var maxSightings = birdsDict.Values.Max(); var minId = birdsDict.Where(x => x.Value == maxSightings).Min(z => z.Key); return minId; }
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 →
C# solution