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 #string
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 canMakeSubsequence(self, str1: str, str2: str) -> bool: if len(str2) > len(str1): return False str2 = list(str2) head = str2[0] def getIncrementedChar(char): if char...
class Solution: def getLucky(self, s: str, k: int) -> int: EXTRA = 96 letters = [] def convert(val): nonlocal letters letters = [] strVal = str(val) for c in str...

class Solution: def replaceWords(self, dictionary: List[str], sentence: str) -> str: roots = set(dictionary) ans = "" cache = {} for word in sentence.split(" "): temp = "" found = False ...

class Solution: def commonChars(self, words: List[str]) -> List[str]: d = defaultdict(int) for e in words[0]: d[e] += 1 for word in words: c = Counter(word) for e in d.keys(): ...

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