RosettaCodeData/Task/Find-the-missing-permutation/Julia/find-the-missing-permutation-2.jl

13 lines
305 B
Julia
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
function missingperm1(arr::Vector{<:AbstractString})
missperm = string()
for pos in 1:length(arr[1])
s = Set()
for perm in arr
c = perm[pos]
if c s pop!(s, c) else push!(s, c) end
end
missperm *= first(s)
end
return missperm
end