Skip to content

Instantly share code, notes, and snippets.

@omokehinde
Created March 7, 2022 21:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save omokehinde/2db2beb623dc585871d6206a040587fa to your computer and use it in GitHub Desktop.
Save omokehinde/2db2beb623dc585871d6206a040587fa to your computer and use it in GitHub Desktop.
def WordSplit(strArr)
# code goes here
dict = strArr[1].split(",")
for i in dict
for j in dict
if i+j == strArr[0]
return "#{i}, #{j}"
end
end
end
return "not possible"
end
puts(WordSplit(["baseball", "a,all,b,ball,bas,base,cat,code,d,e,quit,z"]))
puts(WordSplit(["baseball", "a,all,b,ball,bas,,cat,code,d,e,quit,z"]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment