Make a word chain

  • 24
  • Locked
In the main method, read the name of a file that contains words separated by spaces from the console. In the getLine method, use StringBuilder to order all the words as follows: the last letter of a word must match the first letter of the next word (ignore case). Each word should be used once.
You can't complete this task, because you're not signed in.
Comments (2)
  • Popular
  • New
  • Old
You must be signed in to leave a comment
Jurij Thmsn
Level 25 , Flensburg, Germany
1 July, 07:37
Really tough exercise. I tried different approaches ( recursion, nested loops, while loops, queue) but failed with all of them until I noticed that my code just didn't work because It didn't ignore the case of the characters. Solved it with a queue finally - i took me about 5 hours 🤯 Make sure to write a code that ignores case!
Level 26 , Spanish Town, Jamaica
20 March, 19:41
whew, So this task sent me on a wild journey of teaching myself recursion and even translating a Ruby-coded solution I found when I got stuck. Perhaps not necessary because my first solution was messy but it worked for small inputs, but would take forever for a 100 word input file. if you want resources towards this problem, send me a message! :)