function minimales(lst) res = Vector{Vector{Int}}() for (index, canditate) in enumerate(lst) canditate_set = Set(canditate) is_subset_of_another = any( index != other_index && canditate_set <= Set(other) for (other_index, other) in enumerate(lst) ) if is_subset_of_another continue end if !any(canditate_set == Set(existing) for existing in res) push!(res, canditate) end end return res end check = [[1, 3], [2, 3, 1], [3, 2, 5]] println(minimales(check)) # [[2, 3, 1], [3, 2, 5]] check = [[1, 3], [2, 3, 1], [3, 2, 5], [3, 1]] println(minimales(check)) # [[2, 3, 1], [3, 2, 5]]