masks
to store the bitmask of each word and an array lens
to store the lengths of the words.masks
and lens
respectively.maxProd
to 0 to keep track of the maximum product.(masks[i] & masks[j]) == 0
.maxProd
if the product is greater.maxProd
as the result.