https://leetcode.com/problems/maximum-product-of-word-lengths/
http://blog.youkuaiyun.com/jeason29/article/details/50352667
class Solution {
public:
int maxProduct(vector<string>& words) {
int n = words.size();
vector<int> elements(n, 0);
for (int i = 0; i < n; i++) {
for (int j = 0; j < words[i].length(); j++)
elements[i] |= 1 << (words[i][j] - 'a');
}
int ans = 0;
for (int i = 0; i < n; i++) {
for (int j = i + 1; j < n; j++) {
if (!(elements[i] & elements[j]) && words[i].length() * words[j].length() > ans)
ans = words[i].length() * words[j].length();
}
}
return ans;
}
};