Given a list of non-empty lowercase strings, compute the length of the shortest string that contains every input string as a substring. You may reorder and merge the strings arbitrarily; when you place string A before string B you may overlap a suffix of A with a prefix of B (possibly of length 0) so the overlapped characters are not duplicated. Return the minimum possible length of a single string that contains all given strings as substrings. Constraints: The input list length will be small enough (e.g., up to about 12) so that exponential-time DP with bitmasking is expected to pass. Strings may be duplicated. You must first eliminate strings that are substrings of others. Example: For input ["alex","loves","leetcode","code"], the minimum-length common superstring is "alexlovesleetcode" (length 18), because "code" is a substring of "leetcode" and best overlaps give that minimal length. Your task: implement a function that returns the minimal possible length (an integer).
(["alex", "loves", "leetcode", "code"])18