5 kyu

Find a word sequence

Description:

When no more interesting kata can be resolved, I just choose to create the new kata, to solve their own, to enjoy the process --myjinxin2015 said

Description:

Find a special word sequence that the tail of each word is the same as the head of the next word(the tail of last word is same as the head of first word).

A global variable wordList is preloaded(given by a string array and all words are lowercase). All words should select from wordList.

An argument headTail will be given, like this:

"c4d4e8"

It means:

Three word should be find out
First word is "c??d"
(head is "c",tail is "d", length is 4)
Second word is "d??e"
(head is "d",tail is "e", length is 4)
Third word is "e??????c"
(head is "e",tail is "c", length is 8)

The number between head and tail is the length of word. It always be a positive integer.

The result should be an array that contains all words:

The result of example above should be one of:
['card','date','economic']
['cold','date','economic']

If no valid result found, return an empty array [].

Puzzles

Stats:

CreatedNov 8, 2016
PublishedNov 9, 2016
Warriors Trained210
Total Skips4
Total Code Submissions687
Total Times Completed71
JavaScript Completions71
Total Stars3
% of votes with a positive feedback rating89% of 36
Total "Very Satisfied" Votes31
Total "Somewhat Satisfied" Votes2
Total "Not Satisfied" Votes3
Total Rank Assessments6
Average Assessed Rank
5 kyu
Highest Assessed Rank
5 kyu
Lowest Assessed Rank
6 kyu
Ad
Contributors
  • myjinxin2015 Avatar
  • smile67 Avatar
Ad