Created
March 7, 2022 21:59
-
-
Save omokehinde/2db2beb623dc585871d6206a040587fa to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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