Description
Given an array of strings, find the longest uncommon subsequence. A string that is a subsequence of only one string has maximum length.
Examples
Input:
strs = ["aba","cdc","eae"]Output:
3Explanation:
All are uncommon.
Input:
strs = ["abc","def","abc"]Output:
3Explanation:
"def" is uncommon since it doesn't appear as a subsequence in any other string. "abc" appears twice, so neither instance is uncommon. The longest uncommon subsequence is "def" with length 3.
Input:
strs = ["a","aa","aaa"]Output:
3Explanation:
"a" is a subsequence of "aa" and "aaa", so it's not uncommon. "aa" is a subsequence of "aaa", so it's not uncommon. However, "aaa" is not a subsequence of "a" or "aa", making it uncommon with length 3.
Constraints
- •
2 ≤ strs.length ≤ 50