Class Solution
- java.lang.Object
-
- g0901_1000.s0943_find_the_shortest_superstring.Solution
-
public class Solution extends Object
943 - Find the Shortest Superstring.Hard
Given an array of strings
words, return the smallest string that contains each string inwordsas a substring. If there are multiple valid strings of the smallest length, return any of them.You may assume that no string in
wordsis a substring of another string inwords.Example 1:
Input: words = [“alex”,“loves”,“leetcode”]
Output: “alexlovesleetcode”
Explanation: All permutations of “alex”,“loves”,“leetcode” would also be accepted.
Example 2:
Input: words = [“catg”,“ctaagt”,“gcta”,“ttca”,“atgcatc”]
Output: “gctaagttcatgcatc”
Constraints:
1 <= words.length <= 121 <= words[i].length <= 20words[i]consists of lowercase English letters.- All the strings of
wordsare unique.
-
-
Constructor Summary
Constructors Constructor Description Solution()
-