Migratory Birds

  • + 0 comments

    Python 3 solun using collections.Counter

    from collections import Counter
    
    def migratoryBirds(arr):
        return min([bird for bird, count in Counter(arr).items() if count == max(Counter(arr).values())])
    

    overall time complexity is O(N)