• + 0 comments

    Python 3:

    def migratoryBirds(arr):
        arr_cnt = dict(Counter(arr))
        arr_dict = {i:v for i, v in sorted(arr_cnt.items(), key=lambda x: x[1])}
        arr_val = list(arr_dict.values())[-1]
        key = sorted([k for k, vv in arr_dict.items() if vv==arr_val])[0]
        return key