JS || Single Loop || HashMap
\n/**\n * @param {string} s\n * @return {number}\n */\nvar longestPalindrome = function(s) {\n    let result = 0;\n    const mem = new Set();\n    for(let i=0; 
```\n/**\n * @param {string} s\n * @return {number}\n */\nvar longestPalindrome = function(s) {\n    let result = 0;\n    const mem = new Set();\n    for(let i=0; i<s.length; i++) {\n        if(mem.has(s[i])) {\n            result+=2;\n            mem.delete(s[i]);\n        } else { \n            mem.add(s[i]);\n        }\n    };\n    return result + (mem.size > 0 ? 1 : 0);\n};\n```
['JavaScript']