Coding: Maximum-length unique-character string
You are given an array of strings arr.
You may choose any subset of these strings and concatenate them in any order. The resulting concatenated string must contain only unique characters (i.e., no character appears more than once in the final string).
Return the maximum possible length of such a concatenated string.
Notes / constraints
-
Strings contain lowercase English letters
a
–
z
.
-
You cannot reorder characters
within
a string, but you may choose the order of concatenation by choosing strings in some order.
-
If a string contains duplicate characters internally (e.g.,
"aa"
), it can never be part of a valid concatenation.
Example
-
Input:
arr = ["un","iq","ue"]
-
Output:
4
(choose
"un" + "iq"
or
"iq" + "ue"
)