Level 1 · Foundations
Free Strings lessons
24 lessons, about 218 minutes in all. Each teaches one idea with a visual, then gives you one problem built for it. Read the lessons here, then create a free account to solve the problems and keep your progress.
Stage 0Walking a string
- A string is a row of charactersVisit each character of a string and count the vowels.6 min
- Building a new stringBuild a reversed copy of a string, one character at a time.7 min
- Compare from both endsCheck whether a string reads the same both ways.7 min
- Letters are numbersUse character codes to shift every letter along the alphabet.9 min
Stage 1Counting characters
- Twenty-six boxesCount every letter with a list of 26 counters, one per letter.7 min
- Same letters, any orderTwo words are anagrams when their letter counts match.7 min
- Count first, then lookFind the first character that appears only once, in two passes.7 min
- Enough letters?Check whether one word can be spelled from another's letters.7 min
Stage 2Two pointers on text
- Find a word's two endsWalk from the end, marking where each word starts and stops.9 min
- One mismatch allowedCheck whether deleting at most one character makes a palindrome.10 min
- Measure each runShorten a string by writing each run of a letter once, with its length.8 min
- Two strings, two pointersWeave two strings together, one character from each in turn.6 min
Stage 3Windows on text
- Jump past the repeatThe longest stretch of text with no repeated character.10 min
- Slide the letter countsFind every place where a rearrangement of a word appears.10 min
- At most k kindsThe longest stretch of text using at most k different characters.10 min
- Cover everything, then tightenThe shortest stretch of text that contains every character of a pattern.14 min
Stage 4Parsing
- Reading a number from textTurn the digits at the start of a string into a whole number, carefully.10 min
- Cut at every separatorSplit a line into pieces wherever a separator character appears.8 min
- Column by columnFind the longest start that every word shares.8 min
- Compare piece by pieceDecide which of two version numbers like 1.10 and 1.9 is newer.10 min
Stage 5Mastery
- Build a palindromeThe longest palindrome you can make from a pile of letters.10 min
- Made of copies?Decide whether a string is one piece repeated several times.10 min
- Longest mirror insideThe longest stretch of a string that reads the same both ways.14 min
- Exactly k kindsCount the stretches that use exactly k different characters.14 min
There’s more after this
These are the opening stages of Strings. The full path climbs on to harder problems and a mastery test. Create a free account and we’ll keep your place.
Start the full path free