Pawan's blog

By Pawan, history, 7 years ago, In English

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!

Full text and comments »

  • Vote: I like it
  • +17
  • Vote: I do not like it

By Pawan, history, 7 years ago, In English

Link to accepted solution : Accepted

Link to MLE solution : MLE

Irony is Accepted solution uses more memory than MLE one ! :P

Full text and comments »

  • Vote: I like it
  • +6
  • Vote: I do not like it