Class Solution

  • All Implemented Interfaces:

    
    public final class Solution
    
                        

    943 - Find the Shortest Superstring.

    Hard

    Given an array of strings words, return the smallest string that contains each string in words as a substring. If there are multiple valid strings of the smallest length, return any of them.

    You may assume that no string in words is a substring of another string in words.

    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 <= 12

    • 1 <= words[i].length <= 20

    • words[i] consists of lowercase English letters.

    • All the strings of words are unique.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
      Solution()
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      final String shortestSuperstring(Array<String> words)
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait