Esc
  • Loading…
↑ ↓ to moveEnter to openEsc to close

Strings

Learn what a string really is in memory and what each operation costs, then master the 9 string patterns — from two pointers to dynamic programming — through the interview questions asked most.

  • 5 Lessons
  • 26 Problems
  • 60 Illustrations

What you will learn

  • What a string is, how characters become bytes, and why length means different things in different languages
  • Why strings are immutable in most languages, what s += c in a loop really costs, and how to build strings fast
  • The everyday string operations in JavaScript, Python, Java and C++, and the time each one takes
  • How to read a string question and pick the pattern that solves it
  • 9 patterns from easiest to hardest: two pointers, frequency counting, scan and build, stack, sliding window, expand around the centre, backtracking, string matching and dynamic programming
  • The string questions interviews ask most, each with a dry-run simulator

Why this course

Strings are the data you handle most: names, messages, URLs, code, DNA. They look simple until a question asks you to reverse one in place, count letters in a window, or match a pattern in linear time — and then the details matter.

The introduction is short but complete: what a string is, how it is stored as bytes, why most languages make it immutable, and what every common operation costs. Every later lesson builds on those details.

Then come 9 patterns, from easiest to hardest — each taught through the interview questions that use it, with code in four languages, the complexity of every approach and a simulator you can step through.

Requirements

  • Comfort writing loops, conditionals and functions in at least one language
  • The Arrays course helps: a string is an array of characters with a few extra rules
  • The Hash Map and Stack courses help for the frequency-counting and stack patterns

Course Contents