DSA Pattern
1. Fast and Slow Pointer
Problem
Linked List Cycle II
Remove nth Node from the End of List
Find the Duplicate Number
Palindrome Linked List
2. Overlapping Intervals
Problem
Merge Intervals
Insert Interval
Minimum Number of Arrows to Burst Balloons
Non-overlapping Intervals
3. Prefix Sum
Problem
Find the middle index in array
Product of array except self
Maximum product subarray
Number of ways to split array
4. Sliding Window
Category Problem
Fixed Size Maximum Sum Subarray of Size K
Permutation in String
Sliding Window Maximum
Variable Size Longest Substring Without Repeating Characters
Minimum Size Subarray Sum
Subarray Product Less Than K
Fruits Into Baskets
5. Two Pointers
Problem
Two Sum II - Input Array is Sorted
Dutch National Flag(Sort Colors)
Next Permutation
Container with most water
Trapping Rain Water
6. Reversal of Linked List (In-place)
Problem
Reverse Linked List
Reverse Nodes in k-Group
Swap Nodes in Pairs
7. Breadth First Search (BFS)
Problem
Flood fill
Rotten Oranges
Word Ladder
8. Depth First Search (DFS)
Problem
Cycle detection in Undirected Graphs
Bipartite Graph
DFS from boundary: Number of Enclaves
Number of closed Islands
Find Eventual Safe States
9. Backtracking
Problem
Permutation II
Combination Sum
Generate Parenthesis
N-Queens
Sudoku Solver
Palindrome Partitioning
Word Search
10. Modified Binary Search
Problem
Search in Rotated Sorted Array
Find Peak Element
Capacity to Ship Packages within 'd' Days
Koko Eating Bananas
Median of Two Sorted Arrays
11. Monotonic Stack
Problem
Next Greater Element II
Next Greater Node in Linked List
Daily Temperatures
Largest Rectangle in Histogram
12. Trees
Category Problem
Level Order Traversal Level order Traversal
Zigzag Level order Traversal
Even Odd Tree
Reverse odd Levels
Deepest Leaves Sum
Add one row to Tree
Maximum width of Binary Tree
All Nodes Distance K in Binary tree
Tree Construction Construct BT from Preorder and Inorder
Construct BT from Postorder and Inorder
Maximum Binary Tree
Category Problem
Construct BST from Preorder
Height related Maximum Depth of BT
Balanced Binary Tree
Diameter of Binary Tree
Minimum Depth of BT
Root to leaf path Binary Tree Paths
Path Sum II
Sum Root to Leaf numbers
Smallest string starting from Leaf
Insufficient nodes in root to Leaf
Pseudo-Palindromic Paths in a Binary Tree
Binary Tree Maximum Path Sum
Ancestor problem LCA of Binary Tree
Maximum difference between node and ancestor
LCA of deepest leaves
Kth Ancestor of a Tree Node
Binary Search Tree Validate BST
Range Sum of BST
Minimum Absolute Difference in BST
Category Problem
Insert into a BST
LCA of BST
13. Dynamic Programming
Category Problem
Take / Not take (0/1 Knapsack) House Robber II
Target Sum
Partition Equal Subset Sum
Ones and Zeroes
Last Stone Weight II
Infinite Supply Coin Change
Coin Change II
Perfect Squares
Minimum Cost For Tickets
Longest Increasing Subsequence Longest Increasing Subsequence
Largest Divisible Subset
Maximum Length of Pair Chain
Number of LIS
Longest String Chain
Category Problem
DP on Grids Unique Paths II
Minimum Path Sum
Triangle
Minimum Falling Path Sum
Maximal Square
Cherry Pickup
Dungeon Game
DP on Strings Longest Common Subsequence
Longest Palindromic Subsequence
Palindromic Substrings
Longest Palindromic Substring
Edit Distance
Minimum ASCII Delete Sum for Two Strings
Distinct Subsequences
Shortest Common Supersequence
Wildcard Matching
DP on Stocks Buy and Sell Stocks II
Buy and Sell Stocks III
Buy and Sell Stocks IV
Category Problem
Buy and Sell Stocks with Cooldown
Buy and Sell Stocks with Transaction Fee
14. Graphs
Algorithms : Dijsktra’s , Bellman Ford , Kruskal’s , Prim’s , Topological Sort , Floyd Warshall
Category Problem
Topological Sort Course Schedule
Course Schedule II
Kahn’s Algorithm
Alien Dictionary
Union-Find Number of Operations to Make Network Connected
Redundant Connection
Accounts Merge
Satisfiability of Equality Equations
15. Greedy
Problem
Jump Game II
Gas Station
Problem
Bag of Tokens
Boats to Save People
Wiggle Subsequence
Car Pooling
Candy
Cyclic sort , matrix multiplication , Bitwise XOR , Top K elements , k way merge , two heap ,
design data structures