Medium
Quiz
#522 Longest Uncommon Subsequence II
APPROACH
Given an array of strings strs, return the length of the longest string that is a subsequence of exactly one string in the array but not a subsequence of any other. Return -1 if no such string exists.
A subsequence of a string s is formed by deleting zero or more characters without reordering the rest.
- For instance, "abc" is a subsequence of "aebdc" (remove 'e' and 'd').
Example 1:
Input: strs = ["aba","cdc","eae"]
Output: 3
Example 2:
Input: strs = ["aaa","aaa","aa"]
Output: -1
1 of 4
1:00
What is the optimal approach for this problem?