题目:
题解:
cpp
int maxProduct(char ** words, int wordsSize){
int masks[wordsSize];
memset(masks, 0, sizeof(masks));
for(int i = 0; i < wordsSize; ++i) {
int len = strlen(words[i]);
for(int j = 0; j < len; ++j) {
masks[i] |= 1 << (words[i][j] - 'a');
}
}
int res = 0;
for(int i = 0; i < wordsSize; ++i) {
for(int j = i + 1; j < wordsSize; ++j) {
if((masks[i] & masks[j]) == 0) {
res = fmax(res, strlen(words[i]) * strlen(words[j]));
}
}
}
return res;
}