Python 3 || 3 lines, Counter  || T/S: 99% / 98%
Here\'s the intuition:\n\nWe should use each same-character pair in s in building the longest palindrome. In addition, we can also use any one single character 
Here\'s the intuition:\n\nWe should use each same-character pair in `s` in building the longest palindrome. In addition, we can also use any one single character left after the pairs are used.\n\nHere\'s the plan:\n- We apply `Counter`  to `s` and use `values()` to determine the counts of the distinct characters.\n\n- We determine `pairCounts` the number of same-character pairs .\n- If there is a single character remaining, then `(pairCounts < len(s))` is true, and we use this fact to add 1 to the answer in this case. \n\n```\nclass Solution:\n    def longestPalindrome(self, s: str) -> int:\n \n        c = Counter(s).values()\n\n        pairCounts = 2 * sum(x>>1 for x in c)\n\n        return pairCounts + (pairCounts < len(s))\n```\n[https://leetcode.com/problems/longest-palindrome/submissions/1276889342/?envType=daily-question&envId=2024-06-04](https://leetcode.com/problems/longest-palindrome/submissions/1276889342/?envType=daily-question&envId=2024-06-04)\n\nI could be wrong, but I think that time complexity is *O*(*N*) and space complexity is *O*(*N*), in which *N* ~ `len(s)`.
['Python', 'Python3']