terms made of lowercase English letters. Choose two different words (by position in the list) that have no letter in common and multiply their lengths.
Return the largest such product. If no pair qualifies, return 0.terms=["plum", "kiwi", "pear", "fig", "lychee"] → 24
"kiwi" and "pear" share no letters: 4 · 4 = 16. "lychee" (6 letters) and "kiwi" are disjoint too, and 6 · 4 = 24 is better, so that is the answer.
terms=["ab", "ba", "a"] → 0
Any two words share the letter "a", so no pair works and the answer is 0.
terms=["plum", "kiwi", "pear", "fig", "lychee"]
24
Run checks the first 3 tests in your browser. Submit checks all 69 tests on the server, hidden ones included.