Photo by Surendran MP on Unsplash1400. Construct K Palindrome StringsTapan Rachchh·Jan 11, 2025·1 min readclass Solution: def canConstruct(self, s: str, k: int) -> bool: l = len(s) if l < k: return False if l == k: return True c = Counter(s) oddCount = 0 for e in c: if c.get(e) % 2 != 0: oddCount += 1 return oddCount <= k Pythonleetcodestring#Palindromehashmapcountinggreedy Share this