Skip to content
BytePatterns

Strings

Characters in a row — palindromes, windows, and the hashing that finds a needle fast.

Strings progress0 / 11
  1. String BasicsStrings never change — every edit builds a brand-new one.4m
  2. Valid PalindromeTwo pointers walk inward and settle it in one pass.4m
  3. Reverse WordsFlip the word order without disturbing the letters.4m
  4. Longest Unique SubstringGrow a window, shrink it the moment a letter repeats.5m
  5. Longest Palindromic SubstringStand on every centre and push outwards.5m
  6. Rabin-Karp Rolling HashSlide a number across the text instead of re-reading it.5m
  7. String Matching IntuitionA mismatch already tells you where to restart.5m
  8. Build the KMP TableEvery prefix remembers its longest border.6m
  9. Z-Algorithm IntuitionReuse what an earlier match already proved.6m
  10. String CompressionOne read cursor, one write cursor, no second string.5m
  11. Encode and Decode StringsSend the length first and no character is special.5m

Quiz yourself: 3 questions from this module

1 / 3

Why can a repeated `s += ch` inside a loop cost O(n²)?