You are given a words.
Define a function join(s1, s2) that concatenates two strings s1 and s2 in the following manner:
If the last character of s1 is identical to the first character of s2, the two overlapping characters merge into one.
Otherwise, s1 and s2 are simply concatenated together.
Starting with strwordswords. For each index i from str
join(str, words[i])
join(words[i], str)
Return the minimum possible length of str
Constraints:
words.length
words[i].length
Each character in words[i] is a lowercase English letter.
You are given a words.
Define a function join(s1, s2) that concatenates two strings s1 and s2 in the following manner:
If the last character of s1 is identical to the first character of s2, the two overlapping characters merge into one.
Otherwise, s1 and s2 are simply concatenated together.
Starting with strwordswords. For each index i from str
join(str, words[i])
join(words[i], str)
Return the minimum possible length of str
Constraints:
words.length
words[i].length
Each character in words[i] is a lowercase English letter.