已知一个字符串数组words,要求寻找其中两个没有重复字符的字符串,使得这两个字符串的长度乘积最大,输出这个最大的乘积。如:
words=["abcd","wxyh","defgh"], 其中不包含重复字符的两个字符串是"abcd"和"wxyh",则输出16
words=["a","aa","aaa","aaaa"], 找不到满足要求的两个字符串,则输出0
数据范围:输入的字符串长度满足 ,保证只包含小写字母
Input:
["a","ab","abc","cd","bcd","abcd"]
Output:
4
["a","ab","abc","cd","bcd","abcd"]
4
Input中,不包含相同字符的有三对:
"ab"和"cd"
"a"和"cd"
"a"和"bcd"
所以字符串长度乘积的最大值是4
这道题你会答吗?花几分钟告诉大家答案吧!