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

13 lines
305 B
Text
Raw Permalink Normal View History

2018-06-22 20:57:24 +00: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)
2015-11-18 06:14:39 +00:00
end
2018-06-22 20:57:24 +00:00
return missperm
2015-11-18 06:14:39 +00:00
end