Python3 - O(n) Solution | With Comments.
\nclass Solution:\n    def longestPalindrome(self, words: List[str]) -> int:\n        c = collections.Counter(words)\n        \n\t\t# var to count the no. of 4 
```\nclass Solution:\n    def longestPalindrome(self, words: List[str]) -> int:\n        c = collections.Counter(words)\n        \n\t\t# var to count the no. of 4 char pairs\n\t\t# eg. ty yt -> 1 pair, lb bl -> 1 pair\n        pairs = 0\n\t\t\n\t\t# vars to count the no. of 2 similar char pairs\n\t\t# eg. {aa: 4} -> 4 evens, {gg: 3} -> 3 odds\n        evens = odds = 0\n\t\t\n        for key in c:\n            rev = key[::-1]\n            \n            if key == rev:\n\t\t\t\n\t\t\t# we want to find the max occuring odd char pair to be placed in the mid\n\t\t\t# for every other odd char pair, we want to extract the even pair out of it\n\t\t\t# eg. if {aa: 5} -> we can form "aa aa aa aa" -> 4 evens out of 5 odd pairs\n\t\t\t\n                if c[key] % 2: #odd\n                    odds = max(odds, c[key])\n                    evens += (c[key] - 1)\n\t\t\t\n\t\t\t# for each even pair, we want to include them all\n                else: #even\n                    evens += c[key]\n                    \n            else:\n                pairs += min(c[key], c.get(rev, 0))\n                c[key] = 0\n        \n\t\t# from the evens computed, we want to remove the pair which we had also considered\n\t\t# as the max occuring odd\n\t\t# eg. if {aa: 1, gg: 3, ff: 5, ll: 5} -> max occuring odd is any of "ff" or "ll", i.e 5\n\t\t# evens we HAVE computed = 0 + 2 + 4 + 4 (respectively)\n\t\t# evens we SHOULD HAVE computed = 0 + 2 + 4 (respectively)\n\t\t\n        if odds:\n            evens -= (odds - 1)\n\t\t\t\n        return pairs * 4 + (odds + evens) * 2\n```
[]