C / C++ Solution O(n) time, O(1) space, 100.00% faster!
C Solution\n\n\nint longestPalindrome(char * s)\n{\n        int letters[52] = {0};\n        bool is_odd = false;\n        int longest_palindrome = 0;\n    \n   
# C Solution\n\n```\nint longestPalindrome(char * s)\n{\n        int letters[52] = {0};\n        bool is_odd = false;\n        int longest_palindrome = 0;\n    \n        for(int i = 0; i < strlen(s); i++)\n        {\n            if(*(s + i) <= \'Z\')\n                letters[*(s + i) -\'A\']++;\n            \n            else \n                letters[*(s + i)-\'a\' + 26]++;\n        }\n    \n        for(int i = 0; i < 52; i++)\n        {\n            longest_palindrome += letters[i] / 2;\n            \n            if(letters[i] % 2 == 1)\n                is_odd = true;\n        }\n\t\t\n        return is_odd == true ? 2 * longest_palindrome + 1 : 2 * longest_palindrome;\n}\n```\n\n# C++ Solution\n\n```\nclass Solution \n{\npublic:\n    int longestPalindrome(string s) \n    {\n        vector<int> letters(52, 0);\n        bool is_odd = false;\n        int longest_palindrome = 0;\n    \n        for(int i = 0; i < s.length(); i++)\n        {\n            if(s[i] <= \'Z\')\n                letters[s[i] -\'A\' ]++;\n            \n            else \n                letters[s[i] -\'a\' + 26]++;\n        }\n   \n        for(int i = 0; i < 52; i++)\n        {\n            longest_palindrome += letters[i] / 2;\n            \n            if(letters[i] % 2 ==1)\n                is_odd =true;\n        }\n\t\t\n        return is_odd == true ? 2 * longest_palindrome + 1 : 2 * longest_palindrome;\n    }\n};\n```
[]