Data Structures & Algorithms
147 highly-curated topics available for revision.
1. Complexity
Time Complexity
HighHow does the algorithm scale as data grows?
Space Complexity
HighHow much RAM does your algorithm eat?
Big-O Notation
HighThe absolute worst-case scenario.
Big-Omega and Big-Theta
The Best Case and the Exact Case.
Amortized Analysis
MediumAveraging out the occasional massive spike.
2. Arrays
Arrays
HighThe foundational building block of computer science.
Two Pointers
HighSqueezing the array from both ends.
Sliding Window
HighAnalyzing a continuous chunk of data.
Prefix Sum
HighInstantly querying a range.
Suffix Sum
MediumLooking backwards.
Difference Array
MediumApplying massive updates instantly.
Kadane's Algorithm
HighThe maximum subarray sum.
Merge Intervals
HighCombining overlapping timeframes.
Cyclic Sort
MediumSorting in O(N) without extra space.
3. Strings
Strings
HighArrays in disguise.
String Manipulation
HighSlicing and dicing text.
Frequency Counting
HighTallying the characters.
Palindromes
HighReading the same forwards and backwards.
Anagrams
HighSame letters, different order.
String Matching (Substring Search)
MediumFinding a needle in a haystack.
Longest Substring Without Repeating Characters
HighThe most famous Sliding Window problem.
Pattern Matching (Regex under the hood)
Parsing strings systematically.
4. Hash Table
Hash Tables
HighThe O(1) magic box.
Hash Map (Dictionary)
HighKey-Value pairs.
Hash Set
HighUnique items only.
Frequency Map
HighCounting the occurrences.
The Two Sum Pattern
HighThe most famous interview question in the world.
Collision Handling
When the math fails.
5. Linked List
Singly Linked List
HighConnecting nodes across fragmented memory.
Doubly Linked List
MediumWalking backwards.
Reverse a Linked List
HighThe most famous pointer manipulation problem.
Fast and Slow Pointers (Tortoise & Hare)
HighFloyd's Cycle-Finding Algorithm.
Detect Cycle
HighFinding infinite loops.
Merge Linked Lists
HighZipping two sorted lists together.
Remove Nth Node From End
MediumDeleting from the back in a forward-only list.
Intersection of Linked Lists
When two paths converge.
6. Stack & Queue
Stack
HighLIFO: Last In, First Out.
Queue
HighFIFO: First In, First Out.
Deque (Double-Ended Queue)
MediumThe best of both worlds.
Monotonic Stack
HighFinding the Next Greater Element.
Monotonic Queue
MediumSliding Window Maximum.
Min Stack
HighRetrieving the minimum in O(1) time.
Queue using Stacks
Inverting the flow of data.
7. Recursion
Recursion Concepts
HighFunctions calling themselves.
The Call Stack
HighHow the CPU handles recursion.
The Base Case
HighWhen to stop digging.
Tail Recursion
Hacking the Call Stack.
Backtracking
HighExploring all possibilities.
Permutations
HighRearranging the order.
Subsets
HighTo include, or not to include.
Combinations
MediumSubsets with a fixed length.
8. Trees
Binary Tree
HighBranching data structures.
Tree Traversals
HighHow to visit every node.
Pre-order Traversal
MediumNode -> Left -> Right
In-order Traversal
HighLeft -> Node -> Right
Post-order Traversal
MediumLeft -> Right -> Node
Level Order Traversal (BFS)
HighScanning horizontally.
Binary Search Tree (BST)
HighThe O(log N) lookup machine.
BST Operations
MediumSearching, inserting, and deleting.
Balanced Binary Tree
HighPreventing the straight-line degenerate tree.
Tree Height and Depth
MediumMeasuring the geometry of the tree.
Lowest Common Ancestor (LCA)
HighFinding the junction point.
Serialize and Deserialize Tree
Flattening the tree to a string.
Trie (Prefix Tree)
MediumThe autocomplete engine.
9. Heap
Heap
HighThe fast-track to the extreme.
Min-Heap Implementation
MediumBubbling up and sinking down.
Max-Heap
MediumThe absolute largest.
Priority Queue
HighLine cutting allowed.
Heapify
MediumO(N) magical sorting.
Top K Elements Pattern
HighThe ultimate Heap interview pattern.
Kth Largest Element in an Array
HighQuickSelect vs Heap.
Merge K Sorted Lists
HighThe ultimate tournament bracket.
10. Graphs
Graphs
HighNodes and Edges.
Adjacency List
HighThe gold standard for graph representation.
Adjacency Matrix
The massive 2D grid.
Graph DFS
HighPlunging down the rabbit hole.
Graph BFS
HighThe shortest path.
Number of Islands
HighThe 2D Grid Implicit Graph.
Clone Graph
MediumThe Deep Copy.
Course Schedule
HighDetecting Deadlocks.
Topological Sort
HighKahn's Algorithm.
Dijkstra's Algorithm
HighThe shortest path on a weighted graph.
Bellman-Ford Algorithm
Handling negative weights.
Floyd-Warshall Algorithm
All-Pairs Shortest Path.
Minimum Spanning Tree
Prim's and Kruskal's Algorithms.
Union-Find (Disjoint Set)
HighThe Cycle Detector.
11. Binary Search
Binary Search
HighO(log N) magic on sorted data.
Search Insert Position
HighFinding where it belongs.
First Bad Version
MediumFinding the boundary.
Search in Rotated Sorted Array
HighNavigating the pivot.
Find Minimum in Rotated Sorted Array
MediumFinding the pivot.
Search a 2D Matrix
MediumFlattening the grid.
12. Sorting
Sorting Algorithms
HighBringing order to chaos.
Bubble Sort
Bubbling the largest to the top.
Selection Sort
Selecting the smallest.
Insertion Sort
MediumSorting a deck of cards.
Merge Sort
HighDivide and Conquer.
Quick Sort
HighThe fast, chaotic pivot.
Counting Sort
MediumBreaking the N log N barrier.
Radix Sort
Sorting by digits.
Bucket Sort
Sorting decimals.
13. Greedy
Greedy Algorithms
HighTake what you can get.
Jump Game
HighCan you reach the end?
Jump Game II
HighThe minimum jumps.
Gas Station
MediumThe circular journey.
Hand of Straights
MediumSorting and organizing.
Merge Triplets to Form Target Triplet
Max math.
Partition Labels
MediumFinding the boundaries.
14. Dynamic Programming
Dynamic Programming Concepts
HighThose who cannot remember the past...
Memoization (Top-Down)
HighCaching the recursive tree.
Tabulation (Bottom-Up)
HighBuilding from the ground up.
Climbing Stairs
HighFibonacci in disguise.
Min Cost Climbing Stairs
HighPaying the toll.
House Robber
HighTo rob, or not to rob.
Coin Change
HighThe classic Unbounded Knapsack.
Longest Increasing Subsequence
HighFinding the hidden sequence.
Longest Common Subsequence
HighThe 2D Matrix.
Word Break
MediumSlicing the dictionary.
The Knapsack Problem
MediumThe 0/1 Choice.
Matrix DP
MediumNavigating the grid.
15. Bit Manipulation
Bit Manipulation Basics
MediumSpeaking the machine's language.
AND, OR, XOR
HighThe Logical Gates.
Bit Shifting
MediumSliding the columns.
Number of 1 Bits
HighHamming Weight.
Counting Bits
MediumDP meets Bits.
Missing Number
HighThe XOR cancellation trick.
Reverse Bits
MediumFlipping the mirror.
Single Number
HighThe lone survivor.
16. Math
Math Concepts
MediumThe universal language.
Prime Numbers
HighThe Sieve of Eratosthenes.
Greatest Common Divisor
MediumThe Euclidean Algorithm.
Modular Arithmetic
Clock math.
Pow(x, n)
MediumBinary Exponentiation.
Factorial Trailing Zeroes
Counting the fives.
Integer to Roman
The Greedy Subtraction.
17. Interview Problems
Two Sum
HighThe classic.
LRU Cache
HighLeast Recently Used.
Longest Substring
HighWithout Repeating Characters.
Valid Parentheses
HighThe LIFO Stack.
Merge K Sorted Lists
HighThe Priority Queue.
Trapping Rain Water
HighThe two pointers.
Find Median from Data Stream
HighThe dual heaps.
Word Ladder
MediumThe BFS short path.
Basic Calculator
MediumParsing the math.
Maximum Subarray
HighKadane's Algorithm.
Best Time to Buy and Sell Stock
HighBuy low, sell high.
Product of Array Except Self
HighThe prefix and suffix.