Using JavaScript | T(n) = O(n), S(n) = O(n)
\n/**\n * @param {string[]} words\n * @return {number}\n */\nvar longestPalindrome = function(words) {\n    const map = {};\n    let max = 0;\n    \n    words.f
```\n/**\n * @param {string[]} words\n * @return {number}\n */\nvar longestPalindrome = function(words) {\n    const map = {};\n    let max = 0;\n    \n    words.forEach(word => {\n        const f = word[0];\n        const s = word[1];\n        \n        const revWord = s + f;\n\n        if(revWord in map) {\n            max += 4;\n            map[revWord]--;\n            \n            if(map[revWord] === 0) {\n                delete map[revWord];\n            } \n        } else {\n            map[word] = map[word] ? map[word] + 1 : 1;\n        } \n        \n    });\n    \n    for(let word in map) {\n        if(word[0] === word[1]) {\n            max += 2;\n            break;\n        }\n    }\n    \n    return  max;\n};\n```
[]