Find the string which is made up of maximum number of other strings contained in the same array.

Revision en1, by Pawan, 2017-12-16 18:38:43

PROBLEM:

"Given an array of strings, find the string which is made up of maximum number of other strings contained in the same array."

INPUT :

[ “rat”, ”cat”, “abc”, “xyz”, “abcxyz”, “ratcatabc”, “xyzcatratabc” ]

OUTPUT:

“xyzcatratabc”

Explaination :

“abcxyz” contains 2 other strings
“ratcatabc” contains 3 other strings,
“xyzcatratabc” contains 4 other strings"

I want to know what is the best time complexity with can solve this problem and how ?
I shall be highly thankful to codeforces community!

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English Pawan 2017-12-17 23:00:18 90
en1 English Pawan 2017-12-16 18:38:43 684 Initial revision (published)