June 2018 Update
This commit is contained in:
parent
ba8067c3b7
commit
22f33d4004
5278 changed files with 84726 additions and 14379 deletions
|
|
@ -1,9 +1,17 @@
|
|||
function abc (str, list)
|
||||
isempty(str) && return true
|
||||
for i = eachindex(list)
|
||||
str[end] in list[i] &&
|
||||
any([abc(str[1:end-1], deleteat!(copy(list), i))]) &&
|
||||
return true
|
||||
end
|
||||
false
|
||||
function abc(str::AbstractString, list)
|
||||
isempty(str) && return true
|
||||
for i in eachindex(list)
|
||||
str[end] in list[i] &&
|
||||
any([abc(str[1:end-1], deleteat!(copy(list), i))]) &&
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
let test = ["A", "BARK","BOOK","TREAT","COMMON","SQUAD","CONFUSE"],
|
||||
list = ["BO","XK","DQ","CP","NA","GT","RE","TG","QD","FS",
|
||||
"JW","HU","VI","AN","OB","ER","FS","LY","PC","ZM"]
|
||||
for str in test
|
||||
@printf("%-8s | %s\n", str, abc(str, list))
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue