Reading character by character: words, palindromes, letter counts and sliding windows over text.
Key ideas
- Text is a sequence of characters: index it, slice it, walk it with
for ch in text. - A dict or a list of 26 is enough to count letters.
- Palindrome and window questions on text are solved with two pointers too.
Pattern
i, j = 0, len(text) - 1
while i < j:
if text[i] != text[j]:
break
i += 1
j -= 1Finish these first:HashingTwo Pointers & Sliding Window
Lessons
Each lesson explains one idea from zero and ends with a few tasks. Lessons open in order; the explanation can be read at any time.
Boss
04
Character Replacement
Function
The boss opens when every lesson of the topic is finished. Solve it too and the topic is complete, and the topics after it open.