Animated walkthroughs
231 problems explained the way a good teacher would at a whiteboard: the concept first, then an example traced step by step, then the code, line by line. Each walkthrough runs about eight to ten minutes with narration, and you can pause or step through it at any point.
Watch on YouTube New walkthroughs and Shorts on @AlgoRung.
Low Level Design 48
- Classes and objects Lesson 1
- Encapsulation Lesson 2
- Abstraction Lesson 3
- Inheritance Lesson 4
- Polymorphism Lesson 5
- Interface vs abstract Lesson 6
- Composition > inheritance Lesson 7
- Single responsibility Lesson 8
- Open/closed principle Lesson 9
- Liskov substitution Lesson 10
- Interface segregation Lesson 11
- Dependency inversion Lesson 12
- DRY, KISS and YAGNI Lesson 13
- Coupling and cohesion Lesson 14
- Dependency injection Lesson 15
- Immutable value objects Lesson 16
- Class diagrams Lesson 17
- Use case diagrams Lesson 18
- Sequence diagrams Lesson 19
- Activity diagrams Lesson 20
- Requirements to classes Lesson 21
- Singleton Lesson 22
- Factory method Lesson 23
- Abstract factory Lesson 24
- Builder Lesson 25
- Prototype Lesson 26
- Adapter pattern Lesson 27
- Bridge pattern Lesson 28
- Composite pattern Lesson 29
- Decorator pattern Lesson 30
- Facade pattern Lesson 31
- Flyweight pattern Lesson 32
- Proxy pattern Lesson 33
- Strategy pattern Lesson 34
- Observer pattern Lesson 35
- State pattern Lesson 36
- Command pattern Lesson 37
- Chain of responsibility Lesson 38
- Template method Lesson 39
- Iterator Lesson 40
- Mediator Lesson 41
- Memento Lesson 42
- Visitor pattern Lesson 43
- Interpreter pattern Lesson 44
- Thread safety Lesson 45
- Producer-consumer Lesson 46
- How to answer LLD Lesson 47
- Common LLD mistakes Lesson 48
AI Engineering 5
Arrays & Hashing 28
- Two Sum Two Sum
- 3Sum Two Sum
- Majority Element Moore's Voting Algorithm
- Majority Element II Moore's Voting Algorithm
- Kadane's Algorithm - Simple Kadane's Algorithm
- Find minimum subarray sum Kadane's Algorithm
- Kadane's Algo - Circular Array - No Extra Space Kadane's Algorithm
- Rotate Array Double Reversal Trick
- Reverse Words in a String Double Reversal Trick
- Two Sum II - Input Array Is Sorted Two Pointer
- Valid Triangle Number Two Pointer
- Array Leaders Right to Left Traversal
- Product of Array Except Self Right to Left Traversal
- Set Matrix Zeroes In-place Transformations
- Find All Duplicates in an Array In-place Transformations
- Count Inversions Merge Sort Like Approach
- Arranging the array Merge Sort Like Approach
- Sort Colors Dutch National Flag
- Subarray Sum Equals K Prefix Sum Strategy
- Subarray with given XOR Prefix Sum Strategy
- Range Sum Query - Immutable Prefix Sum Strategy
- Maximum Average Subarray I Sliding Window · Fixed
- K Radius Subarray Averages Sliding Window · Fixed
- Maximum Number of Vowels in a Substring of Given Length Sliding Window · Fixed
- Minimum Size Subarray Sum Sliding Window · Variable
- Count of Subarrays with Product Less Than K Sliding Window · Variable
- Number of Substrings Containing All Three Characters Sliding Window · Hash Map
- Minimum Window Substring Sliding Window · Hash Map
Stack 7
Monotonic Stack 4
Linked List 20
- Remove Linked List Elements Dummy Node Pattern
- Delete Nodes From Linked List Present in Array Dummy Node Pattern
- Merge Two Sorted Lists Dummy Node Pattern
- Rotate List Dummy Node Pattern
- Swap Nodes in Pairs Dummy Node Pattern
- Swapping Nodes in a Linked List Dummy Node Pattern
- Remove Duplicates from Sorted List II Dummy Node Pattern
- Middle of the Linked List Slow Fast Pointers
- Linked List Cycle Slow Fast Pointers
- Linked List Cycle II Slow Fast Pointers
- Remove Nth Node From End of List Front Back Pointer
- Reverse Linked List Front Middle Back Pointer
- Reverse Linked List II Front Middle Back Pointer
- Reverse Nodes in k-Group Front Middle Back Pointer
- Palindrome Linked List Front Middle Back Pointer
- Delete Node in a Linked List Miscellaneous
- Copy List with Random Pointer Miscellaneous
- Intersection of Two Linked Lists Miscellaneous
- Partition List Miscellaneous
- Sort List Miscellaneous
Binary Search 25
- Fundamentals Basics
- Binary Search Basics
- bisect_left, bisect_right Bisect
- Search Insert Position Bisect
- Floor in a Sorted Array Bisect
- Ceil in a Sorted Array Bisect
- Find First and Last Position of Element in Sorted Array Bisect
- Number of occurrence Bisect
- First Bad Version Unique 1-D Binary Search
- Single Element in a Sorted Array Unique 1-D Binary Search
- Find Peak Element Unique 1-D Binary Search
- Find How Many Times Array is Rotated Rotated Array
- Find Minimum in Rotated Sorted Array Rotated Array
- Find Minimum in Rotated Sorted Array II Rotated Array
- Search in Rotated Sorted Array Rotated Array
- Search in Rotated Sorted Array II Rotated Array
- Row with max 1s 2D Binary Search + Step Search
- Search a 2D Matrix 2D Binary Search + Step Search
- Search a 2D Matrix II (Young Tableau) 2D Binary Search + Step Search
- Pow(x, n) (Binary Exponentiation) Search on Answer Range
- Find Nth root of M Search on Answer Range
- Sqrt(x) Search on Answer Range
- Find position of an element in a sorted array of infinite numbers (Galloping Search) Search on Answer Range
- Koko Eating Bananas Binary Search on Answer Space
- Minimum Number of Days to Make m Bouquets Binary Search on Answer Space
Recursion & Backtracking 17
- Factorial of a number Basic Recursion
- Fibonacci Number Basic Recursion
- Binary Tree Inorder Traversal (Recursive) Basic Recursion
- Basic Backtracking Template Basic Recursion
- Binary Tree Paths Basic Recursion
- N-Queens 2D Matrix
- Generate all binary strings without consecutive 1's Pick / Not-Pick
- Subsets (2 choices per element) Pick / Not-Pick
- Subsets II Pick / Not-Pick
- Combinations Pick / Not-Pick
- Combination Sum (repeating elements) Pick / Not-Pick
- Combination Sum II Pick / Not-Pick
- Combination Sum III Pick / Not-Pick
- Permutations - Swap Trick Permutations
- Permutations Permutations
- Permutations II Permutations
- Word Search 2D Matrix Backtracking
Trees & BST 43
- Binary Tree Inorder Traversal (Recursive) Recursion
- Binary Tree Preorder Traversal (Recursive) Recursion
- Binary Tree Postorder Traversal (Recursive) Recursion
- Binary Tree Inorder Traversal (Iterative) Recursion
- Binary Tree Preorder Traversal (Iterative) Recursion
- Binary Tree Postorder Traversal (Iterative) Recursion
- Maximum Depth of Binary Tree Recursion
- Same Tree Recursion
- Symmetric Tree Recursion
- Invert Binary Tree Recursion
- Root to Leaf Paths Backtracking
- Binary Tree Level Order Traversal Traversals
- Binary Tree Zigzag Level Order Traversal Traversals
- Binary Tree Level Order Traversal II Traversals
- Top View of Binary Tree Views
- Bottom View of Binary Tree Views
- Left View of Binary Tree Views
- Binary Tree Right Side View Views
- Search in a Binary Search Tree BST Basics
- Minimum element in BST BST Basics
- Insert into a Binary Search Tree BST Basics
- Balanced Binary Tree Postorder + Multiple Return Values
- Validate Binary Search Tree Postorder + Multiple Return Values
- Children Sum in a Binary Tree Postorder + Multiple Return Values
- Largest BST Postorder + Multiple Return Values
- Lowest Common Ancestor of a Binary Tree LCA
- Lowest Common Ancestor of a Binary Search Tree LCA
- Amount of Time for Binary Tree to Be Infected Child + Ancestor Handling
- Burning Tree Child + Ancestor Handling
- All Nodes Distance K in Binary Tree Child + Ancestor Handling
- Kth Smallest Element in a BST Reverse Inorder Traversal
- Kth Largest Element in BST Reverse Inorder Traversal
- Construct Binary Tree from Preorder and Inorder Traversal Tree Serialization / Deserialization
- Construct Binary Tree from Inorder and Postorder Traversal Tree Serialization / Deserialization
- Construct Binary Search Tree from Preorder Traversal Tree Serialization / Deserialization
- Serialize and Deserialize Binary Tree Tree Serialization / Deserialization
- Binary Tree to DLL Tree to Lists and vice-versa
- Flatten Binary Tree to Linked List Tree to Lists and vice-versa
- Inorder Successor in BST Miscellaneous BST Questions
- Inorder predecessor Miscellaneous BST Questions
- Floor in BST Miscellaneous BST Questions
- Ceil in BST Miscellaneous BST Questions
- Two Sum IV - Input is a BST Miscellaneous BST Questions
Heaps 6
Intervals 9
Tries 2
Graphs 18
- BFS - Normal + Level by Level BFS / DFS Basics
- DFS - Recursive + Iterative BFS / DFS Basics
- Flood Fill Matrix Graphs
- Number of Provinces Connected Components
- Number of Islands Connected Components
- Shortest Path in Binary Matrix BFS for shortest path
- Surrounded Regions DFS - Complement Trick
- Rotting Oranges Multi source BFS
- 01 Matrix Multi source BFS
- Undirected Graph Cycle Cycle Detection
- Directed Graph Cycle Cycle Detection
- Is Graph Bipartite? Cycle Detection
- Topological sort using BFS Topological Sort
- Course Schedule Topological Sort
- Course Schedule II Topological Sort
- Alien Dictionary Topological Sort
- Network Delay Time Dijkstra
- Find the City With the Smallest Number of Neighbors at a Threshold Distance Dijkstra
Dynamic Programming 34
- Fibonacci Number 1D DP
- Climbing Stairs 1D DP
- Min Cost Climbing Stairs (2 jumps) 1D DP
- Minimal Cost (k jumps) 1D DP
- Decode Ways 1D DP
- Word Break 1D DP
- House Robber Alternate Selection / Pick / Not pick
- House Robber II Alternate Selection / Pick / Not pick
- Minimum Path Sum 2D DP
- Unique Paths 2D DP
- Unique Paths II 2D DP
- Minimum Falling Path Sum 2D DP - max/min of last row
- Triangle 2D DP - max/min of last row
- Geek's Training 2D DP - max/min of last row
- Maximal Square Squares
- Count Square Submatrices with All Ones Squares
- Largest 1-Bordered Square Squares
- Best Time to Buy and Sell Stock State Machine DP - Stock Problems
- Best Time to Buy and Sell Stock II State Machine DP - Stock Problems
- Best Time to Buy and Sell Stock with Transaction Fee State Machine DP - Stock Problems
- Best Time to Buy and Sell Stock with Cooldown State Machine DP - Stock Problems
- Best Time to Buy and Sell Stock III State Machine DP - Stock Problems
- 0 - 1 Knapsack Problem Knapsack
- Fractional Knapsack Knapsack
- Knapsack with Duplicate Items Knapsack
- Coin Change Knapsack
- Coin Change II Knapsack
- Edit Distance Strings
- Longest Common Subsequence Strings
- Longest Palindromic Subsequence Strings
- Minimum Insertion Steps to Make a String Palindrome Strings
- Longest Common Substring Strings
- Matrix Chain Multiplication Interval DP
- Burst Balloons Interval DP
Bit Manipulation 12
- Decimal to binary Basics
- Convert Binary Number in a Linked List to Integer Basics
- K-th Bit is Set or Not Basics
- Odd or Even Basics
- Number of 1 Bits Tricks to remember
- Set the rightmost unset bit Tricks to remember
- XOR of 1 to n Numbers Tricks to remember
- Swap two numbers XOR Basics
- Hamming Distance XOR Basics
- Single Number Missing / Repeated Numbers
- Missing Number Missing / Repeated Numbers
- Two numbers with odd occurrences Missing / Repeated Numbers