Migratory Birds

  • + 0 comments
    frequency = {}
        for i in arr:
            frequency[i] = frequency.get(i,0) + 1
        maxCount = 0
        bird = None
        for key, values in frequency.items():
            if values > maxCount:
                maxCount = values
                bird = key  
            if values == maxCount and key < bird:
                bird = key  
        return bird