Python 3 || 3 lines, w/ explanation || T/S: 99% / 96% .
Here\'s how the code works:\n\nThe code initializesdto keep track of the count of each word or its reverse.\n\nWe iterate over each word inwords, and we use the
Here\'s how the code works:\n\nThe code initializes`d`to keep track of the count of each word or its reverse.\n\nWe iterate over each word in`words`, and we use the lexicographic minimum of the word and its reverse (`word[::-1]`)as the key for loading `words` into `d`, which ensures that the same pair is counted only once.\n\nWe return the sum of the counts of pairs in each value (using`x*(x-1)//2`) as the answer.\n```\nclass Solution:\n    def maximumNumberOfStringPairs(self, words: List[str]) -> int:\n\n        d = defaultdict(int)\n\n        for word in words:\n            d[min(word, word[::-1])]+= 1\n        \n        return  sum(map((lambda x: x*(x-1)), d.values()))//2\n```\n[https://leetcode.com/problems/find-maximum-number-of-string-pairs/submissions/1292813544/](https://leetcode.com/problems/find-maximum-number-of-string-pairs/submissions/1292813544/)\n\n\nI could be wrong, but I think that time complexity is *O*(*NM*) and space complexity is *O*(*N*), in which *N* ~`len(nums)` and *M* ~ average`len(word)`.\n
['Python3']