Count Disjoint String Pairs
Examples
Example 1:
Input: words = ["apple","banana","peach","kiwi"]
Output: 3
Explanation:
Example 2:
Input: words = ["abc","def","gh"]
Output: 3
Example 3:
Input: words = ["a","aa","aaa"]
Output: 0
Example 1:
Input: words = ["apple","banana","peach","kiwi"]
Output: 3
Explanation:
Example 2:
Input: words = ["abc","def","gh"]
Output: 3
Example 3:
Input: words = ["a","aa","aaa"]
Output: 0
Given an array of lowercase strings words, return the number of unique index pairs (i, j) such that i < j and the two strings share no common characters.
Two strings are disjoint if there is no character that appears in both strings.
Valid pairs are ["apple","kiwi"], ["banana","kiwi"], and ["peach","kiwi"].
1 <= words.length <= 10001 <= words[i].length <= 1000words[i] consists of lowercase English letters.