Skip to content
CodeItRaw
Path

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 -= 1

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

  1. 01

    A text is a row of characters

    0/3 tasks

  2. 02

    Remembering the state as you scan

    0/2 tasks

  3. 03

    Counting letters

    0/3 tasks

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.