318. Maximum Product of Word Lengths
Practice Maximum Product of Word Lengths for free on NudgeCode: Medium, Bit Manipulation pattern. Write it in Python or JavaScript, run the tests in your browser, and ask for a hint when you are stuck.
Given a list of lowercase words, pick two words that share no letter and multiply their lengths. Return the largest such product, or 0 if every pair of words shares at least one letter.
Example
words = ["abcw","baz","foo","bar","xtfn","abcdef"] -> 16 ("abcw" * "xtfn")
words = ["a","aa","aaa"] -> 0
Constraints
- 2 <= words.length <= 1000
- 1 <= words[i].length <= 1000
- words[i] contains only lowercase English letters