Simple two lines python code


  • 0
    B

    class Solution(object):

    def longestPalindrome(self, s):
    
    
        temp = [s.count(c) for c in string.ascii_letters]
        return sum([i / 2 * 2 for i in temp]) + (1 in [i % 2 for i in temp])

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.