public class Solution {
public int MaxProduct(string[] words) {
if (words == null || words.Length == )
{
return ;
}
int len = words.Length;
int[] value = new int[len];
for (int i = ; i < len; i++)
{
string tmp = words[i];
value[i] = ;
for (int j = ; j < tmp.Length; j++)
{
value[i] |= << (tmp[j] - 'a');
}
}
int maxProduct = ;
for (int i = ; i < len; i++)
{
for (int j = i + ; j < len; j++)
{
if ((value[i] & value[j]) == && (words[i].Length * words[j].Length > maxProduct))
{
maxProduct = words[i].Length * words[j].Length;
}
}
}
return maxProduct;
}
}
https://leetcode.com/problems/maximum-product-of-word-lengths/