Shortest common superstring - Java


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.


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

Your Input :

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 Java Editor for your use