Skip to main content
Learn · DSA

Data Structures & Algorithms

Pattern-driven problem solving. Each guide teaches a transferable pattern with complexity analysis and edge-case traps — not another list of 500 random problems.

22
guides
DSA35 min

How to Approach a DSA Coding Interview

The mindset and time-budget playbook for 45-minute LeetCode-style coding interviews. Covers what interviewers grade, the brute-force-first rule, pattern-recognition reflexes across data structures and algorithms, recovery patterns when stuck, and traps on dynamic programming and graph problems.

DSA InterviewLeetCodePattern RecognitionTwo Pointers+10
Intermediate
8 questions
DSA45 min

How to Design a DSA Solution: From Problem to Clean Code

The mechanical playbook for executing DSA coding interviews. Covers brute-force-to-optimal optimization, data structures and algorithms templates (two pointers, sliding window, binary search, BFS/DFS, monotonic stack, heap, backtracking, dynamic programming), plus LRU cache and trie design problems.

DSA TemplatesLeetCodeTwo PointersSliding Window+10
Intermediate
1 questions
DSA40 min

Backtracking: Permutations, Combinations, Subsets & Word Search

Backtracking is the systematic exploration of all possibilities by building candidates incrementally and abandoning (pruning) paths that can't lead to a solution. Covers the universal backtracking template, permutations, combinations, subsets, N-Queens, and word search — with pruning strategies that make exponential problems practical.

BacktrackingRecursionPermutationsCombinations+11
Intermediate
6 questions
DSA30 min

Bit Manipulation: XOR Tricks, Bit Masking & Power-of-Two Patterns

Bit manipulation problems appear at Google, Amazon, and Meta — often as hard problems with elegant O(1) or O(n) solutions. Master XOR properties (self-inverse, commutative), bit masking for subset enumeration, Brian Kernighan's algorithm for counting set bits, and the classic single-number, missing number, and power-of-two patterns.

Bit ManipulationXORBitmaskBitwise AND OR+8
Intermediate
6 questions
DSA32 min

Greedy Patterns: Interval Scheduling, Jump Game & Activity Selection

Greedy algorithms make the locally optimal choice at each step, hoping to reach a globally optimal solution. Master how to prove greedy correctness (exchange argument), the canonical greedy problems — interval scheduling, jump game, gas station, and task scheduler — and how to recognize when greedy fails and dynamic programming is needed instead.

GreedyInterval SchedulingJump GameActivity Selection+8
Intermediate
5 questions
DSA30 min

Interval Patterns: Merge Intervals, Meeting Rooms & Sweep Line

Interval problems appear constantly at Google, Amazon, and Meta — merge overlapping intervals, find minimum meeting rooms, detect gaps, and the sweep line algorithm for complex overlap counting. Covers the sort-then-scan pattern, event-based sweep line, and the priority queue approach for scheduling problems.

IntervalsMerge IntervalsMeeting RoomsSweep Line+9
Intermediate
1 questions
DSA30 min

Matrix Patterns: Spiral Traversal, Island Problems & Multi-Source BFS

Matrix problems appear at every FAANG company — spiral traversal, number of islands, rotting oranges (multi-source BFS), word search, and the 0/1 matrix distance problem. Master the two core approaches: DFS/BFS for connectivity and spread, and simulation with direction arrays for traversal order problems.

MatrixGridBFSDFS+10
Intermediate
1 questions
DSA35 min

Monotonic Stack and Deque: Next Greater Element in O(n)

The single most underused O(n) pattern in coding interviews. Learn exactly when to use a monotonic stack vs. deque, why storing indices beats storing values, and how to solve histogram rectangle and sliding window maximum problems that stump most candidates.

Monotonic StackMonotonic DequeStackArrays+8
Intermediate
1 questions
DSA35 min

The 8 Core DSA Patterns

Master the 8 pattern families that cover 98% of coding interview questions at top tech companies. Pattern recognition is the single highest-leverage skill for coding interviews.

ArraysGraphsDynamic ProgrammingBinary Search+6
Intermediate
1 questions
DSA35 min

Prefix Sums & Hashing: Subarray Problems in O(n)

Two of the most frequently tested DSA patterns: prefix sums convert subarray queries from O(n) to O(1), and hash maps eliminate the inner loop in most two-pass problems. Covers subarray sum equals K, two-sum variants, longest subarray with constraint, and the combined prefix-sum + hash technique.

Prefix SumHashingSubarray SumTwo Sum+10
Intermediate
1 questions
DSA40 min

Sliding Window: Fixed and Variable Window Patterns

Master the sliding window pattern for contiguous subarray and substring problems. Covers fixed-size and variable-size windows, the expand-shrink template, and the key O(n) insight that most candidates miss until they understand why left never moves backward.

Sliding WindowArraysStringsTwo Pointers+8
Intermediate
1 questions
DSA35 min

Two Pointers: Converging, Fast/Slow, and Floyd's Cycle Detection

Three distinct two-pointer variants with precise invariants, proven correctness, and production-quality implementations. Covers converging pointers for sorted arrays, fast/slow for duplicates and linked list middle, and Floyd's cycle detection with the phase 2 math that most candidates get wrong.

Two PointersSorted ArraysFloyd Cycle DetectionLinked Lists+8
Intermediate
1 questions
DSA40 min

Binary Search Patterns: 3 Templates and Bisect-on-Answer

Master all three binary search templates — exact match, predicate search, and bisect-on-answer. Covers rotated arrays, peak finding, and the hardest LC variant: median of two sorted arrays in O(log min(m,n)).

Binary SearchTwo PointersDivide and ConquerLeetCode+8
Intermediate
5 questions
DSA40 min

Sorting Algorithms: Merge Sort, Quickselect, and Custom Comparators

Sorting for FAANG interviews: when to sort, when to use counting/radix sort, how merge sort counts inversions, and how Quickselect finds Kth largest in O(n) average. Covers the comparison-sort lower bound and Python custom comparators.

SortingMerge SortQuick SortQuickselect+10
Intermediate
1 questions
DSA40 min

Graph Algorithms: BFS, DFS & Topological Sort

Master graph traversal with clear templates for BFS and DFS, cycle detection, topological sort, and shortest path algorithms. Covers both implicit and explicit graph problems.

BFSDFSTopological SortDijkstra+7
Intermediate
6 questions
DSA35 min

Heaps & Priority Queues: Top-K, Merge K Lists, and Two-Heap Patterns

Master the three heap interview patterns: top-K elements in O(n log k), merging K sorted streams in O(N log k), and the two-heap median trick. Includes Python heapq API and lazy deletion for complex problems.

HeapPriority QueueMin HeapMax Heap+9
Intermediate
6 questions
DSA45 min

Binary Trees & BST: Traversals, LCA, and Classic Patterns

Master binary tree traversals (DFS, BFS, iterative), BST operations with full complexity analysis, Lowest Common Ancestor, and serialize/deserialize. Covers the recursive template that solves 80% of tree interview problems.

Binary TreeBSTTree TraversalInorder+10
Intermediate
1 questions
DSA35 min

Tries (Prefix Trees): Autocomplete, Word Search, and Wildcard Matching

Build production-ready tries for O(L) prefix operations, solve Word Search II with backtracking pruning, and implement wildcard matching. Covers the prefix-count optimization used in autocomplete systems.

TriePrefix TreeAutocompleteWord Search+8
Intermediate
1 questions
DSA30 min

Union-Find (DSU): Dynamic Connectivity in Near-Constant Time

Master Disjoint Set Union with path compression and union by rank for O(α(n)) per operation. Covers connected components, cycle detection, accounts merge, and when DSU outperforms BFS/DFS for graph problems.

Union FindDisjoint Set UnionDSUPath Compression+8
Intermediate
1 questions
DSA45 min

Knapsack DP: 0/1, Unbounded, and Subset Sum Variants

Master all knapsack variants by understanding one mental model: dp[i][w] = best value with first i items and capacity w. Covers 0/1 knapsack, unbounded, bounded, Partition Equal Subset Sum, Coin Change, Target Sum, and the critical forward-vs-reverse iteration insight that distinguishes 0/1 from unbounded.

Dynamic ProgrammingKnapsack0/1 KnapsackUnbounded Knapsack+9
Advanced
1 questions
DSA45 min

DP on Strings: LCS, Edit Distance, and Regex Matching

Master the universal 2D string DP template that unlocks LCS, Edit Distance, Longest Palindromic Subsequence, and Regex Matching. Covers state definitions, space optimization from O(nm) to O(min(n,m)), and the five string DP archetypes that appear most in FAANG interviews.

Dynamic ProgrammingLongest Common SubsequenceEdit DistanceLevenshtein Distance+8
Advanced
1 questions
DSA45 min

Dynamic Programming: From Recursion to Optimization

A systematic approach to solving DP problems: from recognizing when to use DP, to formulating states, to writing clean bottom-up solutions. Covers 1D, 2D, and interval DP patterns.

Dynamic ProgrammingMemoizationTabulationRecursion+8
Advanced
1 questions