🔥Most Easy Solution | [JAVA] | HashSet🤗
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\n    public int longestPalindrome(String s) {\n        HashSet<Character>h=new HashSet<>();\n        int len=0;\n        for(char e:s.toCharArray()){\n            if(h.contains(e)){\n                len+=2;\n                h.remove(e);\n            }\n            else{\n                h.add(e);\n            }\n        }\n\n        if(h.size()>0){\n            return len+1;\n        }\n        return len;\n        \n    }\n}\n```
['Java']