Word ladder: Difference between revisions

m
m (→‎{{header|Julia}}: allow multiple solutions)
m (→‎{{header|Julia}}: save a step)
Line 46:
for arr in working
s = arr[end]
push!(tried, arr[end]s)
for j in 1:length(s), c in 'a':'z'
w = s[1:j-1] * c * s[j+1:end]
Line 54 ⟶ 55:
end
isempty(newworking) && return [["This cannot be done."]]
for arr in newworking
push!(tried, arr[end])
end
working = newworking
end
4,105

edits