Skip to main content
added 66 characters in body
Source Link
geokavel
  • 6.7k
  • 3
  • 26
  • 60

This is a variant of Play the word chain and Building a long chain of words .


The input is a non-empty list of unique words at least 2 chars long made of characters in [a-z]. You need to output the length of the longest possible chain, where each subsequent word starts with the last letter of the previous word. You can start with any word on the list.

Another twist is that you are allowed to repeat any single word on the list. However, you can not repeat any two-word block. For example, cat->tac->cat is allowed, but cat->tac->cat->tac is not, because you repeated a two-word block (cat->tac). Also, you can not use the same word twice in a row (e.g. eye->eye).

Examples:

  • cat dog tree egg => 3 (cat->tree->egg)
  • new men ten whim => 5 (ten->new->whim->men->new)
  • truth fret heart his => 5 (fret->truth->heart->truth->his)
  • we were stew early yew easy => 9 (stew->were->early->yew->were->easy->yew->we->easy)
  • tac cat tac cot tac can => 6 (tac->cat->tac->cot->tac->can)

(Let me know if I made a mistake on any of these examples or if you come up with more.)

This is a variant of Play the word chain and Building a long chain of words .


The input is a non-empty list of unique words at least 2 chars long made of characters in [a-z]. You need to output the length of the longest possible chain, where each subsequent word starts with the last letter of the previous word. You can start with any word on the list.

Another twist is that you are allowed to repeat any single word on the list. However, you can not repeat any two-word block. For example, cat->tac->cat is allowed, but cat->tac->cat->tac is not, because you repeated a two-word block (cat->tac). Also, you can not use the same word twice in a row (e.g. eye->eye).

Examples:

  • cat dog tree egg => 3 (cat->tree->egg)
  • new men ten whim => 5 (ten->new->whim->men->new)
  • truth fret heart his => 5 (fret->truth->heart->truth->his)
  • we were stew early yew easy => 9 (stew->were->early->yew->were->easy->yew->we->easy)

(Let me know if I made a mistake on any of these examples or if you come up with more.)

This is a variant of Play the word chain and Building a long chain of words .


The input is a non-empty list of unique words at least 2 chars long made of characters in [a-z]. You need to output the length of the longest possible chain, where each subsequent word starts with the last letter of the previous word. You can start with any word on the list.

Another twist is that you are allowed to repeat any single word on the list. However, you can not repeat any two-word block. For example, cat->tac->cat is allowed, but cat->tac->cat->tac is not, because you repeated a two-word block (cat->tac). Also, you can not use the same word twice in a row (e.g. eye->eye).

Examples:

  • cat dog tree egg => 3 (cat->tree->egg)
  • new men ten whim => 5 (ten->new->whim->men->new)
  • truth fret heart his => 5 (fret->truth->heart->truth->his)
  • we were stew early yew easy => 9 (stew->were->early->yew->were->easy->yew->we->easy)
  • tac cat tac cot tac can => 6 (tac->cat->tac->cot->tac->can)

(Let me know if I made a mistake on any of these examples or if you come up with more.)

Tweeted twitter.com/StackCodeGolf/status/886317908757852160
added 79 characters in body
Source Link
geokavel
  • 6.7k
  • 3
  • 26
  • 60

This is a variant of Play the word chain and Building a long chain of words .


The input is a non-empty list of unique words at least 2 chars long made of characters in [a-z]. You need to output the length of the longest possible chain, where each subsequent word starts with the last letter of the previous word. You can start with any word on the list.

Another twist is that you are allowed to repeat any single word on the list. However, you can not repeat any two words in a row-word block. For example, cat->tac->cat is allowed, but cat->tac->cat->tac is not, because you repeated a two-word block (cat->tac). Also, you can not use the same word twice in a row (e.g. eye->eye).

Examples:

  • cat dog tree egg => 3 (cat->tree->egg)
  • new men ten whim => 5 (ten->new->whim->men->new)
  • truth fret heart his => 5 (fret->truth->heart->truth->his)
  • we were stew early yew easy => 109 (stew->were->early->yew->were->easy->yew->we->easy->yew)

(Let me know if I made a mistake on any of these examples or if you come up with more.)

This is a variant of Play the word chain and Building a long chain of words .


The input is a non-empty list of unique words at least 2 chars long made of characters in [a-z]. You need to output the length of the longest possible chain, where each subsequent word starts with the last letter of the previous word. You can start with any word on the list.

Another twist is that you are allowed to repeat any single word on the list. However, you can not repeat any two words in a row. For example, cat->tac->cat is allowed, but cat->tac->cat->tac is not, because you repeated a two-word block.

Examples:

  • cat dog tree egg => 3 (cat->tree->egg)
  • new men ten whim => 5 (ten->new->whim->men->new)
  • truth fret heart his => 5 (fret->truth->heart->truth->his)
  • we were stew early yew easy => 10 (stew->were->early->yew->were->easy->yew->we->easy->yew)

(Let me know if I made a mistake on any of these examples or if you come up with more.)

This is a variant of Play the word chain and Building a long chain of words .


The input is a non-empty list of unique words at least 2 chars long made of characters in [a-z]. You need to output the length of the longest possible chain, where each subsequent word starts with the last letter of the previous word. You can start with any word on the list.

Another twist is that you are allowed to repeat any single word on the list. However, you can not repeat any two-word block. For example, cat->tac->cat is allowed, but cat->tac->cat->tac is not, because you repeated a two-word block (cat->tac). Also, you can not use the same word twice in a row (e.g. eye->eye).

Examples:

  • cat dog tree egg => 3 (cat->tree->egg)
  • new men ten whim => 5 (ten->new->whim->men->new)
  • truth fret heart his => 5 (fret->truth->heart->truth->his)
  • we were stew early yew easy => 9 (stew->were->early->yew->were->easy->yew->we->easy)

(Let me know if I made a mistake on any of these examples or if you come up with more.)

Source Link
geokavel
  • 6.7k
  • 3
  • 26
  • 60

Word Chain Reloaded

This is a variant of Play the word chain and Building a long chain of words .


The input is a non-empty list of unique words at least 2 chars long made of characters in [a-z]. You need to output the length of the longest possible chain, where each subsequent word starts with the last letter of the previous word. You can start with any word on the list.

Another twist is that you are allowed to repeat any single word on the list. However, you can not repeat any two words in a row. For example, cat->tac->cat is allowed, but cat->tac->cat->tac is not, because you repeated a two-word block.

Examples:

  • cat dog tree egg => 3 (cat->tree->egg)
  • new men ten whim => 5 (ten->new->whim->men->new)
  • truth fret heart his => 5 (fret->truth->heart->truth->his)
  • we were stew early yew easy => 10 (stew->were->early->yew->were->easy->yew->we->easy->yew)

(Let me know if I made a mistake on any of these examples or if you come up with more.)