Word ladder: Difference between revisions
m
→{{header|Julia}}: save a step
m (→{{header|Julia}}: allow multiple solutions) |
m (→{{header|Julia}}: save a step) |
||
Line 46:
for arr in working
s = arr[end]
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."]]
▲ push!(tried, arr[end])
working = newworking
end
|