Level 1 · Foundations
Free Hashing lessons
20 lessons, about 186 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 0Seen before?
- A set remembersSpot a repeated value in one pass by remembering what you've seen.7 min
- A map countsCount every value in one pass, then pick the most common.8 min
- Count as you goUse the counts so far to count matching pairs in one pass.8 min
- Look up the partnerFind two values that add up to a target in one pass.9 min
Stage 1Grouping by key
- Same key, same groupGroup words by a key that's equal for all rearrangements.9 min
- A consistent codeCheck whether one string can be turned into another by renaming letters.9 min
- Letters to wordsCheck that a sentence follows a pattern like "abba".9 min
- Groups of numbersGroup the numbers 1 to n by their digit sum and find the biggest groups.9 min
Stage 2Counting with maps
- A map that slidesReport how many different values each window of k holds.9 min
- Pairs that differ by kCount the different pairs of values that are exactly k apart.9 min
- Meet in the middleCount ways to pick one number from each of four lists that sum to zero.10 min
- Count what came beforeCount stretches with exactly k odd numbers, using running counts in a map.10 min
Stage 3Sets for structure
- What both lists shareFind the values that appear in both lists, using a set of one of them.7 min
- In one but not the otherCount the values that belong to exactly one of two lists.7 min
- Have I been here before?Follow a number sequence and use a set to notice when it loops.8 min
- Many sets at onceCheck a sudoku grid with one set per row, column and box.12 min
Stage 4Mastery
- Shortest stretch, same degreeThe shortest stretch holding every copy of the most frequent value.12 min
- Neighbours in valueThe largest group of values whose max and min differ by exactly 1.10 min
- Pairs that fill up a kCount pairs whose sum is a multiple of k.12 min
- Make every count differentThe fewest deletions so no two letters appear the same number of times.12 min
There’s more after this
These are the opening stages of Hashing. 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