← 返回 meta 的题目列表Maximum Size Subset With All Unique Characters (AI-assisted)
类型:online_judge
Given an array of strings arr, choose a subset (order does not matter) and concatenate all chosen strings into S.
All characters in S must be unique (each character appears at most once).
Return the maximum possible length of S under this constraint.
Additional constraints (matching the interview description):
Character set is lowercase a-z.
If a string contains duplicate characters internally, it cannot be chosen.
Strings that correspond to the same character set (e.g. "abc" and "cba") can be treated as duplicates and deduplicated in preprocessing.
Constraints:
1 <= len(arr) <= 1e5
1 <= len(arr[i]) <= 26
Output: an integer maximum length.
Examples:
["un","iq","ue"] -> 4
["cha","r","act","ers"] -> 6
Example
Input
3
un
iq
ue
Output
4