Tapan Rachchhtapanrachchh.hashnode.dev·Jun 4, 2024409. Longest Palindromeclass Solution: def longestPalindrome(self, s: str) -> int: d = defaultdict(int) x = set() ans = 0 for e in s: d[e] += 1 v = d[e] if v == 2: ans += 2 ...PythonAdd a thoughtful commentNo comments yetBe the first to start the conversation.