aboutsummaryrefslogtreecommitdiff
path: root/challenge-233/eric-cheung/python/ch-1.py
blob: 7123b11bb727476e3001105885b2d089a9337eac (plain)
1
2
3
4
5
6
7
8
9
10
## arrWordList = ["aba", "aabb", "abcd", "bac", "aabc"]  ## Example 1
## arrWordList = ["aabb", "ab", "ba"]  ## Example 2
arrWordList = ["nba", "cba", "dba"]  ## Example 3

arrCharList = ["".join(sorted(list(set([*strWordLoop])))) for strWordLoop in arrWordList]

arrOutputList = [1 for nRowLoop in range(0, len(arrCharList) - 1) for nColLoop in range(nRowLoop + 1, len(arrCharList)) if arrCharList[nRowLoop] == arrCharList[nColLoop]]

print (len(arrOutputList))