Finding the sequence from given list of strings

I am unable to figure out any approach this problem which I have seen somewhere is hackerrank,I could not find the link for the same. If somebody could give some pointers it would be of great help.

Problem statement: Given a list of strings of length 20, this list may also have duplicate strings. We have to determine if its possible to arrange the strings in such a way that starting 5 characters of any string is same as last 5 characters of last string. This sequence should utilize all the strings given including the duplicate strings ( duplicate strings should be used as many times as they appear) and we have sorting this sequence if multiple sequences are possible

I have tried to approach this using maps for storing starting 5 chars and last 5 chars but unable to proceed

Comments (0)