bumpsoo 2025-01-11 22:30:46 +09:00
parent 1d01b3f104
commit 1d6dfd4f8d

View file

@ -0,0 +1,12 @@
# https://leetcode.com/problems/construct-k-palindrome-strings
from typing import Counter
class Solution:
def canConstruct(self, s: str, k: int) -> bool:
if len(s) < k:
return False
c = Counter(s)
odd = sum(v % 2 for v in c.values())
return odd <= k