An interesting problem about String

Revision en1, by brownfox2k6, 2023-04-08 17:05:21

Statement

Given $$$n$$$ strings. Find the string $$$s$$$ with minimal length such that each of $$$n$$$ given strings is a substring of $$$s$$$.

Example:

Input:

3
ab
ba
abb

Output:

abba

This problem is hard for me. Can you give me a hint? Thank you in advance.

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en3 English brownfox2k6 2023-04-08 18:01:51 81 Tiny change: 'n <= 50$\nEvery of' -> 'n <= 50$\n\nEvery of'
en2 English brownfox2k6 2023-04-08 17:53:56 4 Changed from "minimal" to "minimum". Sorry for my wrong grammar.
en1 English brownfox2k6 2023-04-08 17:05:21 344 Initial revision (published)