Shortest common superstring - Py

HARD PYTHON

Given a set of strings, A of length N.
Return the length of the smallest string which has all the strings in the set as a substring.

Example:

Input 1:
    A = ["aaaa", "aa"]
Output 1:
    4
Explanation 1:
    Shortest string: "aaaa"
Input 2:
    A = ["abcd", "cdef", "fgh", "de"]
Output 2:
    8
Explanation 2:
    Shortest string: "abcdefgh"

Your Input :
["CS","seems","good"]


Submit Answer

NOTE These questions can be solved in either Java , Python , Rust, C++, Go or ! However, the language intended for these questions is mentioned along with the question on the top. You need to submit the solution file for the autograder to grade the submission. If you are submitting in Java, make sure that the class name is Main (with a capital M)


Optional Python Editor for your use