Migratory Birds

  • + 1 comment

    // couldn't find better 1 at the time

    def migratoryBirds(arr):

    n_arr = []
    for i in set(arr):
        k = 0
        for j in arr:
            if i == j:
                k += 1
                n_arr.append((i, k))
    
    m = max([i[1] for i in n_arr if i[1]])
    return min([i[0] for i in n_arr if i[1] >= m])