1234. Replace the Substring for Balanced String

```python class Solution: def balancedString(self, s: str) -> int: “”” tc O(N) sc O(1) since only cnt 4 char QWER note,only 4 types of char main idea: two pointer— instead of checking if substring within the window is balanced, we check substring count outside window if by adding them into... [Read More]

266. Palindrome Permutation

```python class Solution: def canPermutePalindrome(self, s: str) -> bool: “”” main idea: check if there is at most one char has odd cnt tc O(N) sc O(26) ~ O(1) “”” cnt = {} for c in s: if c not in cnt: cnt[c] = 1 else: cnt[c] += 1 res... [Read More]
Tags: HashTable