已知一个字符串数组words,要求寻找其中两个没有重复字符的字符串,使得这两个字符串的长度乘积最大,输出这个最大的乘积。如: words=["abcd","wxyh","defgh"], 其中不包含重复字符的两个字符串是"abcd"和"wxyh",则输出16 words=["a","aa","aaa","aaaa"], 找不到满足要求的两个字符串,则输出0 数据范围:输入的字符串长度满足 ,保证只包含小写字母
输入描述:
Input:["a","ab","abc","cd","bcd","abcd"]
输出描述:
Output:4
示例1
输入
["a","ab","abc","cd","bcd","abcd"]
备注:
Input中,不包含相同字符的有三对:"ab"和"cd""a"和"cd""a"和"bcd"所以字符串长度乘积的最大值是4
加载中...