题目:
题解:
func maxProduct(words []string) (ans int) {masks := map[int]int{}for _, word := range words {mask := 0for _, ch := range word {mask |= 1 << (ch - 'a')}if len(word) > masks[mask] {masks[mask] = len(word)}}for x, lenX := range masks {for y, lenY := range masks {if x&y == 0 && lenX*lenY > ans {ans = lenX * lenY}}}return
}