Word ladder: Difference between revisions
Content deleted Content added
m →{{header|Julia}}: allow multiple solutions |
m →{{header|Julia}}: save a step |
||
Line 46: | Line 46: | ||
for arr in working |
for arr in working |
||
s = arr[end] |
s = arr[end] |
||
⚫ | |||
for j in 1:length(s), c in 'a':'z' |
for j in 1:length(s), c in 'a':'z' |
||
w = s[1:j-1] * c * s[j+1:end] |
w = s[1:j-1] * c * s[j+1:end] |
||
Line 54: | Line 55: | ||
end |
end |
||
isempty(newworking) && return [["This cannot be done."]] |
isempty(newworking) && return [["This cannot be done."]] |
||
for arr in newworking |
|||
⚫ | |||
end |
|||
working = newworking |
working = newworking |
||
end |
end |