Javascript | Beats 99% | Easy to Understand | Not Greedy | Linear
\nvar longestPalindrome = function(words) {\n    const map = words.reduce((map, word) => {\n        map[word] || (map[word] = 0);\n        map[word]++;\n       
```\nvar longestPalindrome = function(words) {\n    const map = words.reduce((map, word) => {\n        map[word] || (map[word] = 0);\n        map[word]++;\n        return map;\n    }, {});\n    \n    let samewords = 0;\n    let odds = 0;\n    \n    \n    for(let key in map) {\n        const revKey = [...key].reverse().join(\'\');\n        \n        if (revKey === key) {\n            if (map[key] % 2 === 0) {\n                samewords += map[key];\n            } else {\n                samewords += map[key] - 1;\n                odds++;\n            }\n            continue;\n        }\n        \n        if (map[revKey] > 0 && map[key] > 0) {\n            const min = Math.min(map[key], map[revKey]);\n            samewords += 2 * min;\n            map[key] -= min;\n            map[revKey] -= min;\n        }\n    }\n    \n    if (odds > 0) {\n        samewords++;\n    }\n    \n    return samewords * 2;\n};\n```
['Hash Table', 'JavaScript']