Блог пользователя Pawan

Автор Pawan, история, 6 лет назад, По-английски

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!

Полный текст и комментарии »

  • Проголосовать: нравится
  • +17
  • Проголосовать: не нравится

Автор Pawan, история, 7 лет назад, По-английски

Link to accepted solution : Accepted

Link to MLE solution : MLE

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

Полный текст и комментарии »

  • Проголосовать: нравится
  • +6
  • Проголосовать: не нравится