We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a577a4a commit adf6965Copy full SHA for adf6965
leetcode/easy/409_longest_palindrome.md
@@ -29,19 +29,19 @@ class Solution:
29
def longestPalindrome(self, s: str) -> int:
30
ch_to_count = Counter(s)
31
longest_length = 0
32
- only_one = greater_than_one = False
+ only_one = odd_greater_than_one = False
33
for count in ch_to_count.values():
34
if count % 2 == 0: # even
35
longest_length += count
36
else: # odd
37
if count == 1:
38
only_one = True
39
else:
40
- greater_than_one = True
+ odd_greater_than_one = True
41
longest_length += count-1
42
if only_one:
43
longest_length += 1
44
- elif greater_than_one:
+ elif odd_greater_than_one:
45
46
return longest_length
47
```
0 commit comments