You are given two strings s and t. You have to nd a string with the minimum length that contains
both s and t as substrings. If there are multiple such strings return the lexicographically smallest
one.
Example 1:
Input:
s = "asdfg"
t = "fghj"
Output:
"asdfghj"
Explanation:
The string "asdfghj" contains s and t both as substrings.
Example 2:
Input:
s = "bacbab"
t = "aba"
Output:
"abacbab"
Explanation:
The possible two strings of length 7 are "abacbab"
and "bacbaba". But the string "abacbab" is lexicographically
smaller.
Your Task:
You don't need to read input or print anything. Your task is to complete the
function commonString() which takes two strings s and t as input parameters and returns the
required string.
---------------
找最短的长度,如果长度一样,就找最小的字典序的字符串,
因为不知道哪种情况最短,就两个办法都放进去,
Join(a,b), Join(b,a)
然后写个方法join,就是b的前缀跟a的后缀去匹配。
没想到这个办法。。