Shortest common superstring

Problem Setter: raghav_aggiwal
Problem Tester: dhruvi

Given a set of strings. Find the length of smallest string which
has all the strings in the set as substring

Constraints:
1) 1 <= Number of strings <= 18
2) Length of any string in the set will not exceed 100.

Example:
Input: [“abcd”, “cdef”, “fgh”, “de”]
Output: 8 (Shortest string: “abcdefgh”)

NOTE: You only need to implement the given function. Do not read input, instead use the arguments to the function. Do not print the output, instead return values as specified. Still have a doubt? Checkout Sample Codes for more details.
Start solving Shortest common superstring on Interview Code Editor
Sign Up
to access hints and editorial solutions for Shortest common superstring
Asked In:
  • Google

Discussion


Loading...
Click here to start solving coding interview questions