Maximum Length of a Concatenated String with Unique Characters
You are given an array of strings arr. A string s is formed by the concatenation of a subsequence of arr that has unique characters. Return the maximum possible length of s. A subsequence keeps the original order but may drop any elements.
30:00
Maximum Length of a Concatenated String with Unique Characters
You are given an array of strings arr. A string s is formed by the concatenation of a subsequence of arr that has unique characters. Return the maximum possible length of s. A subsequence keeps the original order but may drop any elements.
Example 1:
Input: {"arr":["un","iq","ue"]}
Output: 4
Constraints:
1≤arr.length≤16
1≤arr[i].length≤26
arr[i] contains only lowercase English letters.
Test Cases
Input (Stdin)
Expected Output (Stdout)
Execution Result
Run code to see results.
Input
arr ={"arr":["un","iq","ue"]}
Start with one letter set: the empty string. Every reachable concatenation will be built by extending a set already in the list.