1400. Construct K Palindrome Strings
class 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: ...

Search for a command to run...
Articles tagged with #palindrome
class 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: ...

class 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 ...

class Solution: def partition(self, s: str) -> List[List[str]]: def checkPalindrome(word): return word == word[::-1] ans = [] def backtrack(index, prev, temp): nonlocal ans if index >= ...

Comparing my code from a year ago. Sep 14, 2022 temp = [] d={} ans = 0 class Solution: def pseudoPalindromicPaths (self, root: Optional[TreeNode]) -> int: def goDeep(node): global temp,d,ans if node: ...