Patterns A to Z
Patterns
Know the pattern you need? Pick it from the list. Each one links to the lessons that teach it, with code and practice problems.
Cyclic sort
1 lessonFoundations
4 lessons- 01Eight data structuresThe eight structures every pattern is built on, and what each operation costs.
- 02Big-O: time and spaceCount how the steps grow with the input: O(1), O(log n), O(n), O(n²).
- 03Same structure, three languagesOne pseudocode, mapped line by line to Java, Python, C++ and JavaScript.
- 04How to attack any problemRead the constraints, write the brute force, then optimise and test the edges.
Hashing
1 lessonKadane's algorithm
1 lessonMerge intervals
1 lessonMoore's voting
1 lessonNext permutation
1 lessonNumber theory
2 lessonsPrefix sum
2 lessonsSliding window
3 lessons- 07Sliding window, fixed sizeNumbers next to each other and a fixed length k: one number in, one out, reuse the previous sum.
- 08Sliding window, any sizeThe longest stretch in a row that follows a rule, like sum ≤ 5: grow on the right, shrink on the left.
- 09Minimum Window SubstringThe shortest stretch that holds every letter of t: grow until nothing is missing, then shrink.