DSA tutorials
277 articles · page 11 of 14Hand-written tutorials, ordered as a recommended learning path.
- 201 Prefix Sum Advanced Master advanced prefix sum techniques — 2D prefix sums for submatrix queries, difference arrays for range updates in O(1), subarray sum divisible by K, XOR prefix, and more.
- 202 BS on Answer Advanced Solve advanced binary search on answer problems — Koko eating bananas, ship packages, split array largest sum, minimize max distance to gas station, and magnetic force between balls.
- 203 Space Optimization Master space optimization — rolling arrays for DP, in-place algorithms, bit manipulation as sets, Morris traversal, constant-space linked list operations, and Floyd's cycle detection.
- 204 Interview Checklist The complete DSA interview checklist — 75 essential problems organized by pattern, study schedules for 4, 8, and 12 weeks, a pattern recognition framework, and what interviewers actually look for.
- 205 Reverse String Solve the Reverse String problem in place using the two-pointer technique. Walkthrough, complexity analysis, edge cases, and clean Java, Python, and C++ implementations.
- 206 Palindrome Number Detect integer palindromes by reversing half the digits with integer math. Learn why string conversion is discouraged and how to handle negatives and trailing zeros.
- 207 Fizz Buzz Solve Fizz Buzz with clean code and explore the string-concatenation pattern that avoids nested if-else. Python, Java, C++, and complexity analysis included.
- 208 Max Product Subarray Solve Maximum Product Subarray in linear time by tracking running min and max. Learn why negative numbers flip the role of min and max and see clean code.
- 209 Min in Rotated Solve Find Minimum in Rotated Sorted Array in logarithmic time with a modified binary search. Learn the pivot-finding invariant, edge cases, and how to extend the pattern to related problems.
- 210 Complexity Cheatsheet A printable cheatsheet of time and space complexities for arrays, hashmaps, trees, heaps, graphs, sorts, and common algorithms. Includes worst-case notes and quick rules of thumb.
- 211 Sparse Table Master sparse tables for O(1) range minimum/maximum queries with O(n log n) preprocessing. Learn construction, idempotent functions, and when to use sparse tables over segment trees.
- 212 Sqrt Decomposition Learn sqrt decomposition for O(sqrt(n)) range queries and updates, plus Mo's algorithm for answering offline queries efficiently. Full Python implementations included.
- 213 Binary Lifting Master binary lifting to answer Lowest Common Ancestor (LCA) and kth ancestor queries in O(log n) with O(n log n) preprocessing. Full Python implementations with tree examples.
- 214 Rabin-Karp Learn the Rabin-Karp algorithm for string matching using rolling hash. Covers polynomial hashing, collision avoidance, multiple pattern matching, and comparison with KMP.
- 215 Z-Algorithm Master the Z-algorithm for pattern matching in O(n) time. Learn Z-array construction, the Z-box optimization, and applications like finding string periods and distinct substrings.
- 216 Suffix Arrays Learn suffix arrays from scratch -- naive and O(n log^2 n) construction, LCP arrays, pattern searching with binary search, and applications like longest repeated substring.
- 217 Randomized Algorithms Explore randomized algorithms -- QuickSelect for O(n) kth element, reservoir sampling for streams, randomized quicksort, skip lists, bloom filters, and Monte Carlo vs Las Vegas classification.
- 218 Binary Search on Answer Learn to binary search on the answer space — the powerful technique behind problems like splitting arrays, Koko eating bananas, and capacity to ship packages.
- 219 Floyd-Warshall Master the Floyd-Warshall algorithm — understand the DP recurrence, implement it in Python, detect negative cycles, and know when to pick it over Dijkstra.
- 220 Graph Coloring Learn graph coloring fundamentals — check if a graph is bipartite using BFS/DFS, solve m-coloring with backtracking, and tackle classic interview problems.