Free DSA course · beginner friendly
Learn DSA by spotting the pattern.
Most coding interview problems are a few dozen patterns in disguise. One Hint Away teaches data structures and algorithms one pattern at a time, in order: the clue that gives it away, a dry run you can follow, and code in four languages.
- Lessons
- 21
- Patterns
- 11
- Practice problems
- 55
- Languages
- 4
How every lesson works
From “I’ve never seen this” to solved, in four steps.
- 01
Spot the clue
Every pattern leaves a clue in the problem statement. Learn the words that give it away.
- 02
Watch it run
A dry run on a tiny input, step by step on the slides, so you see why it works.
- 03
Code it your way
Pseudocode first, then tested code in Java, Python, C++ and JavaScript.
- 04
Practice
Hand-picked LeetCode problems, easiest first, each with a one-line hint.
The roadmap
One path from zero to interview ready.
Follow the sections in order, or jump to the one you need. New lessons land every few days on @onehintaway.
- 00Start here1 lesson
- 01Foundations4 lessons
- 02Arrays and hashing14 lessons
- 03Maths2 lessons
- 04Recursion and sortingComing soon
- 05Binary searchComing soon
- 062D arrays and stringsComing soon
- 07BacktrackingComing soon
- 08Linked listComing soon
- 09Bit manipulationComing soon
- 10GreedyComing soon
- 11Stack and queueComing soon
- 12TreesComing soon
- 13HeapsComing soon
- 14GraphsComing soon
- 15Dynamic programmingComing soon
- 16Tries and stringsComing soon
- 17Advanced (optional)Coming soon
All lessons
Every lesson, in reading order.
Start here
1 lessonFoundations
4 lessons- 01FoundationsEight data structuresThe eight structures every pattern is built on, and what each operation costs.
- 02FoundationsBig-O: time and spaceCount how the steps grow with the input: O(1), O(log n), O(n), O(n²).
- 03FoundationsSame structure, three languagesOne pseudocode, mapped line by line to Java, Python, C++ and JavaScript.
- 04FoundationsHow to attack any problemRead the constraints, write the brute force, then optimise and test the edges.
Arrays and hashing
14 lessons- 05HashingHashing"How many times?" or "have I seen this before?": reach for a hash map.
- 06Two pointersTwo pointersA sorted array and a pair to find: start at both ends and walk inward.
- 07Sliding windowSliding window, fixed sizeNumbers next to each other and a fixed length k: one number in, one out, reuse the previous sum.
- 08Sliding windowSliding window, any sizeThe longest stretch in a row that follows a rule, like sum ≤ 5: grow on the right, shrink on the left.
- 09Sliding windowMinimum Window SubstringThe shortest stretch that holds every letter of t: grow until nothing is missing, then shrink.
- 10Prefix sumPrefix sumMany "sum from left to right" questions on an array that never changes: build once, answer each with one subtraction.
- 11Prefix sumPrefix sum with a hash mapCount subarrays that add up to k, even with negative numbers: remember how often each running sum appeared.
- 12Kadane's algorithmKadane's algorithmThe largest sum of numbers in a row: drop the running sum as soon as it goes below zero.
- 13Three-way partitionThree-way partitionOnly three kinds of values to group in place: three pointers, one pass.
- 14Moore's votingMoore's votingFind the value that appears more than half the time, with one candidate and one count.
- 15Cyclic sortCyclic sortNumbers from 0 to n in an array of about n seats: put each number in its own seat.
- 16Merge intervalsMerge intervalsOverlapping ranges to combine: sort by start, then stretch the last block or start a new one.
- 17Next permutationNext PermutationThe next bigger order of an array: find the pivot, swap it with its partner, reverse the tail.
- 18Two pointersTrapping Rain WaterWater above each bar is the lower of the tallest walls on its two sides, minus the bar.
Maths
2 lessonsOne new pattern every few days.
Follow @onehintaway on Instagram for the slides as they come out, then come back here for the code.