Skip to main content
Photo from unsplash: https://res.cloudinary.com/daubpssfa/image/upload/v1747467512/IMG-20250517-WA0000_uipueu.jpg

Master DSA Cheatsheet: Pattern Mastery

Written on May 23, 2025 by alpha.

Last updated May 23, 2025.

See changes
66 min read
––– views
Read in Hindi

DSA Preparation Sheet

Chapter 1: Arrays

Sub-Topics (Patterns): Two Pointers, Sliding Window, Kadane’s Algorithm, Prefix Sum, Hashing

Pattern 1: Two Pointers

IndexProblemPatternDifficultyAlgorithmSolveQuestion Link
1Two SumTwo PointersEasyHashing or Two PointersLeetCode
23SumTwo PointersMediumSorting + Two PointersLeetCode
34SumTwo PointersMediumSorting + Two PointersLeetCode
4Container With Most WaterTwo PointersMediumTwo PointersLeetCode
5Trapping Rain WaterTwo PointersHardTwo PointersLeetCode
6Remove Duplicates from Sorted ArrayTwo PointersEasyTwo PointersLeetCode
7Sort ColorsTwo PointersMediumDutch National FlagLeetCode
8Merge Sorted ArrayTwo PointersEasyTwo PointersLeetCode
9Longest Substring with At Most K Distinct CharactersTwo PointersHardSliding Window + Two PointersLeetCode
10Find the Duplicate NumberTwo PointersMediumFloyd’s Cycle DetectionLeetCode
11Move ZeroesTwo PointersEasyTwo PointersLeetCode
12Valid PalindromeTwo PointersEasyTwo PointersLeetCode
13Partition LabelsTwo PointersMediumGreedy + Two PointersLeetCode
14Two Sum II - Input Array Is SortedTwo PointersMediumTwo PointersLeetCode
15Minimum Size Subarray SumTwo PointersMediumTwo PointersLeetCode

Pattern 2: Sliding Window

IndexProblemPatternDifficultyAlgorithmSolveQuestion Link
1Longest Substring Without Repeating CharactersSliding WindowMediumSliding WindowLeetCode
2Minimum Window SubstringSliding WindowHardSliding WindowLeetCode
3Longest Repeating Character ReplacementSliding WindowMediumSliding WindowLeetCode
4Maximum Subarray Sum of Size KSliding WindowEasySliding WindowLeetCode
5Fruit Into BasketsSliding WindowMediumSliding WindowLeetCode
6Permutation in StringSliding WindowMediumSliding WindowLeetCode
7Longest Substring with At Most Two Distinct CharactersSliding WindowMediumSliding WindowLeetCode
8Minimum Size Subarray SumSliding WindowMediumSliding WindowLeetCode
9Max Consecutive Ones IIISliding WindowMediumSliding WindowLeetCode
10Sliding Window MaximumSliding WindowHardDeque + Sliding WindowLeetCode
11Number of Subarrays with Bounded MaximumSliding WindowMediumSliding WindowLeetCode
12Subarrays with K Different IntegersSliding WindowHardSliding WindowLeetCode
13Longest Continuous Subarray With Absolute Diff Less Than or Equal to LimitSliding WindowHardSliding Window + DequeLeetCode
14Grumpy Bookstore OwnerSliding WindowMediumSliding WindowLeetCode
15Frequency of the Most Frequent ElementSliding WindowHardSliding Window + SortingLeetCode

Pattern 3: Kadane’s Algorithm

IndexProblemPatternDifficultyAlgorithmSolveQuestion Link
1Maximum SubarrayKadane’sMediumKadane’s AlgorithmLeetCode
2Maximum Product SubarrayKadane’sMediumModified Kadane’sLeetCode
3Maximum Sum Circular SubarrayKadane’sMediumKadane’s + Corner CaseLeetCode
4Best Time to Buy and Sell StockKadane’sEasyKadane’s VariationLeetCode
5Maximum Absolute Sum of Any SubarrayKadane’sMediumKadane’s VariationLeetCode
6Longest Turbulent SubarrayKadane’sMediumKadane’s VariationLeetCode
7Subarray Product Less Than KKadane’sMediumSliding Window + Kadane’sLeetCode
8Maximum Subarray Min-ProductKadane’sHardKadane’s + StackLeetCode
9Maximum Alternating Subarray SumKadane’sMediumKadane’s VariationLeetCode
10Largest Sum of AveragesKadane’sHardDP + Kadane’sLeetCode
11Maximum Length of Subarray With Positive ProductKadane’sMediumKadane’s VariationLeetCode
12Maximum Points You Can Obtain from CardsKadane’sMediumSliding Window + Kadane’sLeetCode
13Maximum Sum of Two Non-Overlapping SubarraysKadane’sMediumKadane’s + Prefix SumLeetCode
14Maximum Subarray Sum After One OperationKadane’sHardKadane’s + DPLeetCode
15Find Subarray With Equal SumKadane’sMediumKadane’s VariationLeetCode

Pattern 4: Prefix Sum

IndexProblemPatternDifficultyAlgorithmSolveQuestion Link
1Subarray Sum Equals KPrefix SumMediumPrefix Sum + HashMapLeetCode
2Continuous Subarray SumPrefix SumMediumPrefix Sum + ModuloLeetCode
3Range Sum Query - ImmutablePrefix SumEasyPrefix SumLeetCode
4Find Pivot IndexPrefix SumEasyPrefix SumLeetCode
5Path Sum IIIPrefix SumMediumPrefix Sum + HashMapLeetCode
6Subarray Sums Divisible by KPrefix SumMediumPrefix Sum + ModuloLeetCode
7Maximum Size Subarray Sum Equals kPrefix SumMediumPrefix Sum + HashMapLeetCode
8Number of Ways to Split ArrayPrefix SumMediumPrefix SumLeetCode
9Running Sum of 1d ArrayPrefix SumEasyPrefix SumLeetCode
10Find the Middle Index in ArrayPrefix SumEasyPrefix SumLeetCode
11Maximum Sum of Two Non-Overlapping SubarraysPrefix SumMediumPrefix Sum + Kadane’sLeetCode
12Product of Array Except SelfPrefix SumMediumPrefix ProductLeetCode
13Count Number of Nice SubarraysPrefix SumMediumPrefix Sum + HashMapLeetCode
14Binary Subarrays With SumPrefix SumMediumPrefix Sum + HashMapLeetCode
15Subarrays with Product Less Than KPrefix SumMediumSliding Window + PrefixLeetCode

Pattern 5: Hashing

IndexProblemPatternDifficultyAlgorithmSolveQuestion Link
1Two SumHashingEasyHashMapLeetCode
2Longest Consecutive SequenceHashingMediumHashSetLeetCode
3Group AnagramsHashingMediumHashMap + SortingLeetCode
4Top K Frequent ElementsHashingMediumHashMap + HeapLeetCode
5Subarray Sum Equals KHashingMediumPrefix Sum + HashMapLeetCode
6Valid AnagramHashingEasyHashMapLeetCode
7Find All Anagrams in a StringHashingMediumSliding Window + HashMapLeetCode
8Minimum Window SubstringHashingHardSliding Window + HashMapLeetCode
9Contains DuplicateHashingEasyHashSetLeetCode
10Longest Substring with At Most K Distinct CharactersHashingHardSliding Window + HashMapLeetCode
11Find Duplicate SubtreesHashingMediumHashMap + SerializationLeetCode
12Count Number of Nice SubarraysHashingMediumPrefix Sum + HashMapLeetCode
13Random Pick with WeightHashingMediumPrefix Sum + HashMapLeetCode
14Longest Substring Without Repeating CharactersHashingMediumSliding Window + HashMapLeetCode
15K Closest Points to OriginHashingMediumHeap + HashMapLeetCode

Chapter 2: Linked Lists

Sub-Topics (Patterns): Fast & Slow Pointers, Reversal, Merging, Cycle Detection

Pattern 1: Fast & Slow Pointers

IndexProblemPatternDifficultyAlgorithmSolveQuestion Link
1Linked List CycleFast & SlowEasyFloyd’s Cycle DetectionLeetCode
2Linked List Cycle IIFast & SlowMediumFloyd’s Cycle DetectionLeetCode
3Middle of the Linked ListFast & SlowEasyFast & Slow PointersLeetCode
4Remove Nth Node From End of ListFast & SlowMediumFast & Slow PointersLeetCode
5Find the Duplicate NumberFast & SlowMediumFloyd’s Cycle DetectionLeetCode
6Happy NumberFast & SlowEasyFloyd’s Cycle DetectionLeetCode
7Palindrome Linked ListFast & SlowMediumFast & Slow + ReversalLeetCode
8Intersection of Two Linked ListsFast & SlowEasyTwo PointersLeetCode
9Detect Cycle in Directed GraphFast & SlowMediumDFS + Cycle DetectionLeetCode
10Reorder ListFast & SlowMediumFast & Slow + ReversalLeetCode
11Add Two Numbers IIFast & SlowMediumStack + Fast & SlowLeetCode
12Find the Minimum and Maximum Number of Nodes Between Critical PointsFast & SlowMediumFast & SlowLeetCode
13Rotate ListFast & SlowMediumFast & SlowLeetCode
14Odd Even Linked ListFast & SlowMediumFast & SlowLeetCode
15Swap Nodes in PairsFast & SlowMediumFast & SlowLeetCode

Pattern 2: Reversal

IndexProblemPatternDifficultyAlgorithmSolveQuestion Link
1Reverse Linked ListReversalEasyIterative ReversalLeetCode
2Reverse Linked List IIReversalMediumIterative ReversalLeetCode
3Palindrome Linked ListReversalMediumFast & Slow + ReversalLeetCode
4Reverse Nodes in k-GroupReversalHardIterative ReversalLeetCode
5Rotate ListReversalMediumReversal + Fast & SlowLeetCode
6Swap Nodes in PairsReversalMediumReversalLeetCode
7Reorder ListReversalMediumFast & Slow + ReversalLeetCode
8Reverse Nodes in Even Length GroupsReversalMediumReversalLeetCode
9Add Two NumbersReversalMediumReversal + AdditionLeetCode
10Next Greater Node In Linked ListReversalMediumStack + ReversalLeetCode
11Flatten a Multilevel Doubly Linked ListReversalMediumReversal + DFSLeetCode
12Reverse Nodes in Odd Length GroupsReversalMediumReversalLeetCode
13Merge k Sorted ListsReversalHardReversal + HeapLeetCode
14Sort ListReversalMediumMerge Sort + ReversalLeetCode
15Add Two Numbers IIReversalMediumStack + ReversalLeetCode

Pattern 3: Merging

IndexProblemPatternDifficultyAlgorithmSolveQuestion Link
1Merge Two Sorted ListsMergingEasyMergingLeetCode
2Merge k Sorted ListsMergingHardHeap + MergingLeetCode
3Sort ListMergingMediumMerge SortLeetCode
4Merge Nodes in Between ZerosMergingMediumMergingLeetCode
5Add Two NumbersMergingMediumMerging + AdditionLeetCode
6Intersection of Two Linked ListsMergingEasyTwo PointersLeetCode
7Flatten a Multilevel Doubly Linked ListMergingMediumDFS + MergingLeetCode
8Merge In Between Linked ListsMergingMediumMergingLeetCode
9Reorder ListMergingMediumFast & Slow + MergingLeetCode
10Partition ListMergingMediumMergingLeetCode
11Sort ListMergingMediumMerge SortLeetCode
12Odd Even Linked ListMergingMediumMergingLeetCode
13Merge Nodes in Between ZerosMergingMediumMergingLeetCode
14Swap Nodes in PairsMergingMediumMergingLeetCode
15Rotate ListMergingMediumMerging + RotationLeetCode

Pattern 4: Cycle Detection

IndexProblemPatternDifficultyAlgorithmSolveQuestion Link
1Linked List CycleCycle DetectionEasyFloyd’s Cycle DetectionLeetCode
2Linked List Cycle IICycle DetectionMediumFloyd’s Cycle DetectionLeetCode
3Find the Duplicate NumberCycle DetectionMediumFloyd’s Cycle DetectionLeetCode
4Happy NumberCycle DetectionEasyFloyd’s Cycle DetectionLeetCode
5Circular Array LoopCycle DetectionMediumFloyd’s Cycle DetectionLeetCode
6Course ScheduleCycle DetectionMediumDFS + Cycle DetectionLeetCode
7Course Schedule IICycle DetectionMediumDFS + Topological SortLeetCode
8Graph Valid TreeCycle DetectionMediumUnion-FindLeetCode
9Find Eventual Safe StatesCycle DetectionMediumDFS + Cycle DetectionLeetCode
10Minimum Number of Vertices to Reach All NodesCycle DetectionMediumDFS + Cycle DetectionLeetCode
11Longest Cycle in a GraphCycle DetectionHardDFS + Cycle DetectionLeetCode
12Detect Cycles in 2D GridCycle DetectionMediumDFS + Cycle DetectionLeetCode
13Find the Town JudgeCycle DetectionEasyGraph + In-degreeLeetCode
14Number of Distinct IslandsCycle DetectionMediumDFS + HashingLeetCode
15Cycle Length in a GraphCycle DetectionHardDFS + Cycle DetectionLeetCode

Chapter 3: Trees

Sub-Topics (Patterns): DFS, BFS, Binary Search Trees, Tree Construction

Pattern 1: Depth-First Search (DFS)

IndexProblemPatternDifficultyAlgorithmSolveQuestion Link
1Maximum Depth of Binary TreeDFSEasyDFSLeetCode
2Path SumDFSEasyDFSLeetCode
3Path Sum IIDFSMediumDFSLeetCode
4Path Sum IIIDFSMediumDFS + Prefix SumLeetCode
5Lowest Common Ancestor of a Binary TreeDFSMediumDFSLeetCode
6Binary Tree Maximum Path SumDFSHardDFSLeetCode
7Validate Binary Search TreeDFSMediumDFSLeetCode
8Diameter of Binary TreeDFSEasyDFSLeetCode
9Binary Tree Right Side ViewDFSMediumDFSLeetCode
10Sum Root to Leaf NumbersDFSMediumDFSLeetCode
11Construct Binary Tree from Preorder and Inorder TraversalDFSMediumDFSLeetCode
12Serialize and Deserialize Binary TreeDFSHardDFSLeetCode
13Find Duplicate SubtreesDFSMediumDFS + HashingLeetCode
14Count Good Nodes in Binary TreeDFSMediumDFSLeetCode
15Binary Tree Zigzag Level Order TraversalDFSMediumDFS + ReverseLeetCode

Pattern 2: Breadth-First Search (BFS)

IndexProblemPatternDifficultyAlgorithmSolveQuestion Link
1Binary Tree Level Order TraversalBFSMediumBFSLeetCode
2Binary Tree Zigzag Level Order TraversalBFSMediumBFS + ReverseLeetCode
3Populating Next Right Pointers in Each NodeBFSMediumBFSLeetCode
4Binary Tree Right Side ViewBFSMediumBFSLeetCode
5Minimum Depth of Binary TreeBFSEasyBFSLeetCode
6Average of Levels in Binary TreeBFSEasyBFSLeetCode
7Binary Tree Level Order Traversal IIBFSMediumBFSLeetCode
8Maximum Level Sum of a Binary TreeBFSMediumBFSLeetCode
9Rotting OrangesBFSMediumBFSLeetCode
10Shortest Path in Binary MatrixBFSMediumBFSLeetCode
11Word LadderBFSHardBFSLeetCode
12Open the LockBFSMediumBFSLeetCode
13Nearest Exit from Entrance in MazeBFSMediumBFSLeetCode
14Snakes and LaddersBFSMediumBFSLeetCode
15Minimum Genetic MutationBFSMediumBFSLeetCode

Pattern 3: Binary Search Trees (BST)

IndexProblemPatternDifficultyAlgorithmSolveQuestion Link
1Validate Binary Search TreeBSTMediumDFSLeetCode
2Insert into a Binary Search TreeBSTMediumBST InsertionLeetCode
3Delete Node in a BSTBSTMediumBST DeletionLeetCode
4Kth Smallest Element in a BSTBSTMediumInorder TraversalLeetCode
5Search in a Binary Search TreeBSTEasyBST SearchLeetCode
6Lowest Common Ancestor of a BSTBSTEasyBST PropertyLeetCode
7Recover Binary Search TreeBSTHardInorder TraversalLeetCode
8Convert Sorted Array to BSTBSTEasyDivide and ConquerLeetCode
9Balance a Binary Search TreeBSTMediumInorder + ConstructionLeetCode
10Two Sum IV - Input is a BSTBSTEasyInorder + HashSetLeetCode
11Increasing Order Search TreeBSTEasyInorder TraversalLeetCode
12Kth Largest Element in a BSTBSTMediumReverse InorderLeetCode
13All Elements in Two Binary Search TreesBSTMediumInorder + MergeLeetCode
14Construct Binary Search Tree from Preorder TraversalBSTMediumPreorder + BSTLeetCode
15Closest Binary Search Tree ValueBSTEasyBST SearchLeetCode

Pattern 4: Tree Construction

IndexProblemPatternDifficultyAlgorithmSolveQuestion Link
1Construct Binary Tree from Preorder and Inorder TraversalTree ConstructionMediumDFSLeetCode
2Construct Binary Tree from Inorder and Postorder TraversalTree ConstructionMediumDFSLeetCode
3Convert Sorted Array to BSTTree ConstructionEasyDivide and ConquerLeetCode
4Construct Binary Search Tree from Preorder TraversalTree ConstructionMediumPreorder + BSTLeetCode
5Serialize and Deserialize Binary TreeTree ConstructionHardDFSLeetCode
6Construct Binary Tree from StringTree ConstructionMediumDFSLeetCode
7Construct Quad TreeTree ConstructionMediumDivide and ConquerLeetCode
8Construct Binary Tree from Preorder and Postorder TraversalTree ConstructionMediumDFSLeetCode
9Maximum Binary TreeTree ConstructionMediumMonotonic StackLeetCode
10Merge Two Binary TreesTree ConstructionEasyDFSLeetCode
11Construct String from Binary TreeTree ConstructionEasyDFSLeetCode
12Create Binary Tree From DescriptionsTree ConstructionMediumHashMap + DFSLeetCode
13Balance a Binary Search TreeTree ConstructionMediumInorder + ConstructionLeetCode
14Convert Sorted List to BSTTree ConstructionMediumInorder + DivideLeetCode
15Construct Maximum Binary Tree IITree ConstructionMediumMonotonic StackLeetCode

Chapter 4: Graphs

Sub-Topics (Patterns): DFS, BFS, Topological Sort, Union-Find, Shortest Path

Pattern 1: Depth-First Search (DFS)

IndexProblemPatternDifficultyAlgorithmSolveQuestion Link
1Number of IslandsDFSMediumDFSLeetCode
2Max Area of IslandDFSMediumDFSLeetCode
3Flood FillDFSEasyDFSLeetCode
4Surrounded RegionsDFSMediumDFSLeetCode
5Number of Connected Components in an Undirected GraphDFSMediumDFSLeetCode
6Course ScheduleDFSMediumDFS + Cycle DetectionLeetCode
7Course Schedule IIDFSMediumDFS + Topological SortLeetCode
8Find Eventual Safe StatesDFSMediumDFS + Cycle DetectionLeetCode
9Number of Distinct IslandsDFSMediumDFS + HashingLeetCode
10Pacific Atlantic Water FlowDFSMediumDFSLeetCode
11Longest Increasing Path in a MatrixDFSHardDFS + MemoizationLeetCode
12Detect Cycles in 2D GridDFSMediumDFS + Cycle DetectionLeetCode
13Word SearchDFSMediumDFS + BacktrackingLeetCode
14Word Search IIDFSHardDFS + TrieLeetCode
15Critical Connections in a NetworkDFSHardDFS + Tarjan’sLeetCode

Pattern 2: Breadth-First Search (BFS)

IndexProblemPatternDifficultyAlgorithmSolveQuestion Link
1Rotting OrangesBFSMediumBFSLeetCode
2Shortest Path in Binary MatrixBFSMediumBFSLeetCode
3Word LadderBFSHardBFSLeetCode
4Open the LockBFSMediumBFSLeetCode
5Nearest Exit from Entrance in MazeBFSMediumBFSLeetCode
6Snakes and LaddersBFSMediumBFSLeetCode
7Minimum Genetic MutationBFSMediumBFSLeetCode
8Shortest Path with Alternating ColorsBFSMediumBFSLeetCode
9Bus RoutesBFSHardBFSLeetCode
10Sliding PuzzleBFSHardBFSLeetCode
11Minimum Jumps to Reach HomeBFSMediumBFSLeetCode
12Shortest BridgeBFSMediumDFS + BFSLeetCode
1301 MatrixBFSMediumBFSLeetCode
14Shortest Path in a Grid with Obstacles EliminationBFSHardBFSLeetCode
15Word Ladder IIBFSHardBFS + BacktrackingLeetCode

Pattern 3: Topological Sort

IndexProblemPatternDifficultyAlgorithmSolveQuestion Link
1Course ScheduleTopological SortMediumDFS + Topological SortLeetCode
2Course Schedule IITopological SortMediumDFS + Topological SortLeetCode
3Alien DictionaryTopological SortHardTopological SortLeetCode
4Minimum Height TreesTopological SortMediumTopological SortLeetCode
5Sequence ReconstructionTopological SortMediumTopological SortLeetCode
6Longest Increasing Path in a MatrixTopological SortHardDFS + MemoizationLeetCode
7Parallel CoursesTopological SortMediumTopological SortLeetCode
8Minimum Number of Vertices to Reach All NodesTopological SortMediumTopological SortLeetCode
9Sort Items by Groups Respecting DependenciesTopological SortHardTopological SortLeetCode
10Find All Possible Recipes from Given SuppliesTopological SortMediumTopological SortLeetCode
11Build a Matrix With ConditionsTopological SortHardTopological SortLeetCode
12Parallel Courses IIITopological SortHardTopological SortLeetCode
13Longest Cycle in a GraphTopological SortHardDFS + Cycle DetectionLeetCode
14Course Schedule IVTopological SortMediumTopological Sort + DFSLeetCode
15Check if Move is LegalTopological SortMediumGraph + DFSLeetCode

Pattern 4: Union-Find

IndexProblemPatternDifficultyAlgorithmSolveQuestion Link
1Number of Connected Components in an Undirected GraphUnion-FindMediumUnion-FindLeetCode
2Graph Valid TreeUnion-FindMediumUnion-FindLeetCode
3Redundant ConnectionUnion-FindMediumUnion-FindLeetCode
4Accounts MergeUnion-FindMediumUnion-FindLeetCode
5Most Stones Removed with Same Row or ColumnUnion-FindMediumUnion-FindLeetCode
6Satisfiability of Equality EquationsUnion-FindMediumUnion-FindLeetCode
7Smallest String With SwapsUnion-FindMediumUnion-FindLeetCode
8Number of ProvincesUnion-FindMediumUnion-FindLeetCode
9Minimum Score of a Path Between Two CitiesUnion-FindMediumUnion-FindLeetCode
10Lexicographically Smallest Equivalent StringUnion-FindMediumUnion-FindLeetCode
11Similar String GroupsUnion-FindHardUnion-FindLeetCode
12Remove Max Number of Edges to Keep Graph Fully TraversableUnion-FindHardUnion-FindLeetCode
13Connecting Cities With Minimum CostUnion-FindMediumKruskal’s AlgorithmLeetCode
14Optimize Water Distribution in a VillageUnion-FindHardKruskal’s AlgorithmLeetCode
15Redundant Connection IIUnion-FindHardUnion-FindLeetCode

Pattern 5: Shortest Path

IndexProblemPatternDifficultyAlgorithmSolveQuestion Link
1Network Delay TimeShortest PathMediumDijkstra’sLeetCode
2Cheapest Flights Within K StopsShortest PathMediumBellman-FordLeetCode
3Path With Minimum EffortShortest PathMediumDijkstra’sLeetCode
4Find the City With the Smallest Number of Neighbors at a Threshold DistanceShortest PathMediumFloyd-WarshallLeetCode
5Shortest Path in Binary MatrixShortest PathMediumBFSLeetCode
6Shortest Path with Alternating ColorsShortest PathMediumBFSLeetCode
7Path with Maximum ProbabilityShortest PathMediumDijkstra’sLeetCode
8Shortest Path in a Grid with Obstacles EliminationShortest PathHardBFSLeetCode
9Minimum Cost to Make at Least One Valid Path in a GridShortest PathHardDijkstra’sLeetCode
10Shortest Path to Get All KeysShortest PathHardBFSLeetCode
11Reconstruct ItineraryShortest PathHardDFS + Eulerian PathLeetCode
12Second Minimum Time to Reach DestinationShortest PathHardDijkstra’sLeetCode
13Minimum Cost to Reach Destination in TimeShortest PathHardDijkstra’sLeetCode
14Number of Ways to Arrive at DestinationShortest PathMediumDijkstra’sLeetCode
15Shortest BridgeShortest PathMediumDFS + BFSLeetCode

Chapter 5: Dynamic Programming

Sub-Topics (Patterns): 1D DP, 2D DP, Subsequence DP, Knapsack, Matrix DP

Pattern 1: 1D DP

IndexProblemPatternDifficultyAlgorithmSolveQuestion Link
1Climbing Stairs1D DPEasyDPLeetCode
2Fibonacci Number1D DPEasyDPLeetCode
3Min Cost Climbing Stairs1D DPEasyDPLeetCode
4House Robber1D DPMediumDPLeetCode
5House Robber II1D DPMediumDPLeetCode
6Paint House1D DPMediumDPLeetCode
7Decode Ways1D DPMediumDPLeetCode
8Coin Change1D DPMediumDPLeetCode
9Coin Change 21D DPMediumDPLeetCode
10Partition Equal Subset Sum1D DPMediumDPLeetCode
11Arithmetic Slices1D DPMediumDPLeetCode
12Number of Longest Increasing Subsequence1D DPMediumDPLeetCode
13Delete and Earn1D DPMediumDPLeetCode
14Paint Fence1D DPMediumDPLeetCode
15Maximum Product of Splitted Binary Tree1D DPMediumDPLeetCode

Pattern 2: 2D DP

IndexProblemPatternDifficultyAlgorithmSolveQuestion Link
1Unique Paths2D DPMediumDPLeetCode
2Unique Paths II2D DPMediumDPLeetCode
3Longest Common Subsequence2D DPMediumDPLeetCode
4Edit Distance2D DPHardDPLeetCode
5Minimum Path Sum2D DPMediumDPLeetCode
6Dungeon Game2D DPHardDPLeetCode
7Longest Palindromic Subsequence2D DPMediumDPLeetCode
8Regular Expression Matching2D DPHardDPLeetCode
9Wildcard Matching2D DPHardDPLeetCode
10Interleaving String2D DPHardDPLeetCode
11Distinct Subsequences2D DPHardDPLeetCode
12Longest Valid Parentheses2D DPHardDPLeetCode
13Maximum Subarray Sum Circular2D DPMediumKadane’s + DPLeetCode
14Count Square Submatrices with All Ones2D DPMediumDPLeetCode
15Minimum Falling Path Sum2D DPMediumDPLeetCode

Pattern 3: Subsequence DP

IndexProblemPatternDifficultyAlgorithmSolveQuestion Link
1Longest Increasing SubsequenceSubsequence DPMediumDPLeetCode
2Longest Common SubsequenceSubsequence DPMediumDPLeetCode
3Longest Palindromic SubsequenceSubsequence DPMediumDPLeetCode
4Number of Longest Increasing SubsequenceSubsequence DPMediumDPLeetCode
5Distinct SubsequencesSubsequence DPHardDPLeetCode
6Longest Arithmetic SubsequenceSubsequence DPMediumDPLeetCode
7Longest Arithmetic Subsequence of Given DifferenceSubsequence DPMediumDPLeetCode
8Maximum Length of Pair ChainSubsequence DPMediumDPLeetCode
9Longest String ChainSubsequence DPMediumDPLeetCode
10Longest Continuous Increasing SubsequenceSubsequence DPEasyDPLeetCode
11Longest Turbulent SubarraySubsequence DPMediumDPLeetCode
12Longest Subsequence Repeated k TimesSubsequence DPHardDPLeetCode
13Longest Ideal SubsequenceSubsequence DPMediumDPLeetCode
14Longest Common Subsequence Between Sorted ArraysSubsequence DPMediumDPLeetCode
15Longest Palindromic SubstringSubsequence DPMediumDPLeetCode

Pattern 4: Knapsack

IndexProblemPatternDifficultyAlgorithmSolveQuestion Link
10/1 Knapsack ProblemKnapsackMediumDPLeetCode
2Partition Equal Subset SumKnapsackMediumDPLeetCode
3Target SumKnapsackMediumDPLeetCode
4Coin ChangeKnapsackMediumDPLeetCode
5Coin Change 2KnapsackMediumDPLeetCode
6Combination Sum IVKnapsackMediumDPLeetCode
7Ones and ZeroesKnapsackMediumDPLeetCode
8Last Stone Weight IIKnapsackMediumDPLeetCode
9Profitable SchemesKnapsackHardDPLeetCode
10Number of Ways to Form a Target String Given a DictionaryKnapsackHardDPLeetCode
11Partition to K Equal Sum SubsetsKnapsackMediumDPLeetCode
12Knapsack with Duplicate ItemsKnapsackMediumDPGeeksforGeeks
13Minimum Cost For TicketsKnapsackMediumDPLeetCode
14Number of Ways to Stay in the Same Place After Some StepsKnapsackHardDPLeetCode
15Count Subsets with Sum KKnapsackMediumDPGeeksforGeeks

Pattern 5: Matrix DP

IndexProblemPatternDifficultyAlgorithmSolveQuestion Link
1Unique PathsMatrix DPMediumDPLeetCode
2Unique Paths IIMatrix DPMediumDPLeetCode
3Minimum Path SumMatrix DPMediumDPLeetCode
4Dungeon GameMatrix DPHardDPLeetCode
5Count Square Submatrices with All OnesMatrix DPMediumDPLeetCode
6Minimum Falling Path SumMatrix DPMediumDPLeetCode
7TriangleMatrix DPMediumDPLeetCode
8Maximal SquareMatrix DPMediumDPLeetCode
9Longest Line of Consecutive One in MatrixMatrix DPMediumDPLeetCode
10Number of Ways to Paint N × 3 GridMatrix DPHardDPLeetCode
11Maximum Alternating Subsequence SumMatrix DPMediumDPLeetCode
12Longest Common SubpathMatrix DPHardDPLeetCode
13Minimum Cost to Cut a StickMatrix DPHardDPLeetCode
14Burst BalloonsMatrix DPHardDPLeetCode
15Stone GameMatrix DPMediumDPLeetCode

Chapter 6: Heaps

Sub-Topics (Patterns): Min/Max Heap, Priority Queue, Kth Element

Pattern 1: Min/Max Heap

IndexProblemPatternDifficultyAlgorithmSolveQuestion Link
1Kth Largest Element in an ArrayMin/Max HeapMediumMin HeapLeetCode
2Top K Frequent ElementsMin/Max HeapMediumMin HeapLeetCode
3Merge k Sorted ListsMin/Max HeapHardMin HeapLeetCode
4Find Median from Data StreamMin/Max HeapHardTwo HeapsLeetCode
5K Closest Points to OriginMin/Max HeapMediumMax HeapLeetCode
6Task SchedulerMin/Max HeapMediumMin HeapLeetCode
7Reorganize StringMin/Max HeapMediumMax HeapLeetCode
8Kth Largest Element in a StreamMin/Max HeapEasyMin HeapLeetCode
9Top K Frequent WordsMin/Max HeapMediumMin HeapLeetCode
10Find K Pairs with Smallest SumsMin/Max HeapHardMin HeapLeetCode
11Minimum Cost to Connect SticksMin/Max HeapMediumMin HeapLeetCode
12Furthest Building You Can ReachMin/Max HeapMediumMin HeapLeetCode
13Kth Smallest Element in a Sorted MatrixMin/Max HeapMediumMin HeapLeetCode
14Smallest Range Covering Elements from K ListsMin/Max HeapHardMin HeapLeetCode
15Reorder Data in Log FilesMin/Max HeapMediumHeap + SortingLeetCode

Pattern 2: Priority Queue

IndexProblemPatternDifficultyAlgorithmSolveQuestion Link
1Merge k Sorted ListsPriority QueueHardPriority QueueLeetCode
2Task SchedulerPriority QueueMediumPriority QueueLeetCode
3Find Median from Data StreamPriority QueueHardTwo Priority QueuesLeetCode
4Kth Largest Element in a StreamPriority QueueEasyPriority QueueLeetCode
5K Closest Points to OriginPriority QueueMediumPriority QueueLeetCode
6Top K Frequent ElementsPriority QueueMediumPriority QueueLeetCode
7Reorganize StringPriority QueueMediumPriority QueueLeetCode
8Minimum Cost to Connect SticksPriority QueueMediumPriority QueueLeetCode
9Furthest Building You Can ReachPriority QueueMediumPriority QueueLeetCode
10Kth Smallest Element in a Sorted MatrixPriority QueueMediumPriority QueueLeetCode
11Find K Pairs with Smallest SumsPriority QueueHardPriority QueueLeetCode
12Smallest Range Covering Elements from K ListsPriority QueueHardPriority QueueLeetCode
13Sliding Window MaximumPriority QueueHardDeque + Priority QueueLeetCode
14Top K Frequent WordsPriority QueueMediumPriority QueueLeetCode
15Minimum Interval to Include Each QueryPriority QueueHardPriority QueueLeetCode

Pattern 3: Kth Element

IndexProblemPatternDifficultyAlgorithmSolveQuestion Link
1Kth Largest Element in an ArrayKth ElementMediumMin HeapLeetCode
2Kth Smallest Element in a Sorted MatrixKth ElementMediumMin HeapLeetCode
3Kth Largest Element in a StreamKth ElementEasyMin HeapLeetCode
4Top K Frequent ElementsKth ElementMediumMin Heap + HashMapLeetCode
5Top K Frequent WordsKth ElementMediumMin Heap + HashMapLeetCode
6Kth Smallest Element in a BSTKth ElementMediumInorder TraversalLeetCode
7K Closest Points to OriginKth ElementMediumMax HeapLeetCode
8Kth Smallest Number in Multiplication TableKth ElementHardBinary SearchLeetCode
9Find K Pairs with Smallest SumsKth ElementHardMin HeapLeetCode
10Kth Smallest Prime FractionKth ElementHardMin HeapLeetCode
11Kth Largest Sum in a Binary TreeKth ElementMediumMax HeapLeetCode
12Kth Ancestor of a Tree NodeKth ElementHardBinary LiftingLeetCode
13Kth Missing Positive NumberKth ElementEasyLinear SearchLeetCode
14Kth Largest Element in an Array (QuickSelect)Kth ElementMediumQuickSelectLeetCode
15Kth Smallest InstructionsKth ElementHardDP + CombinatoricsLeetCode

Chapter 7: Strings

Sub-Topics (Patterns): String Matching, Palindromes, Anagrams, Pattern Matching

Pattern 1: String Matching

IndexProblemPatternDifficultyAlgorithmSolveQuestion Link
1Longest Substring Without Repeating CharactersString MatchingMediumSliding WindowLeetCode
2Minimum Window SubstringString MatchingHardSliding WindowLeetCode
3Find All Anagrams in a StringString MatchingMediumSliding WindowLeetCode
4Permutation in StringString MatchingMediumSliding WindowLeetCode
5Longest Repeating Character ReplacementString MatchingMediumSliding WindowLeetCode
6Valid AnagramString MatchingEasyHashMapLeetCode
7Group AnagramsString MatchingMediumHashMap + SortingLeetCode
8Longest Substring with At Most K Distinct CharactersString MatchingHardSliding WindowLeetCode
9String CompressionString MatchingMediumTwo PointersLeetCode
10Longest Common PrefixString MatchingEasyVertical ScanningLeetCode
11Valid PalindromeString MatchingEasyTwo PointersLeetCode
12Valid Palindrome IIString MatchingEasyTwo PointersLeetCode
13Minimum Length of String After Deleting Similar EndsString MatchingMediumTwo PointersLeetCode
14Longest Substring with At Most Two Distinct CharactersString MatchingMediumSliding WindowLeetCode
15Shortest Way to Form StringString MatchingMediumGreedyLeetCode

Pattern 2: Palindromes

IndexProblemPatternDifficultyAlgorithmSolveQuestion Link
1Longest Palindromic SubstringPalindromesMediumExpand Around CenterLeetCode
2Palindromic SubstringsPalindromesMediumExpand Around CenterLeetCode
3Valid PalindromePalindromesEasyTwo PointersLeetCode
4Valid Palindrome IIPalindromesEasyTwo PointersLeetCode
5Longest Palindromic SubsequencePalindromesMediumDPLeetCode
6Break a PalindromePalindromesMediumGreedyLeetCode
7Shortest PalindromePalindromesHardKMP AlgorithmLeetCode
8Palindrome PartitioningPalindromesMediumBacktrackingLeetCode
9Palindrome Partitioning IIPalindromesHardDPLeetCode
10Count Different Palindromic SubsequencesPalindromesHardDPLeetCode
11Longest Chunked Palindrome DecompositionPalindromesHardTwo PointersLeetCode
12Remove Palindromic SubsequencesPalindromesEasyTwo PointersLeetCode
13Maximum Number of Non-Overlapping Palindrome SubstringsPalindromesHardDPLeetCode
14Valid Palindrome IVPalindromesMediumTwo PointersLeetCode
15Palindrome PairsPalindromesHardHashMap + TrieLeetCode

Pattern 3: Anagrams

IndexProblemPatternDifficultyAlgorithmSolveQuestion Link
1Valid AnagramAnagramsEasyHashMapLeetCode
2Group AnagramsAnagramsMediumHashMap + SortingLeetCode
3Find All Anagrams in a StringAnagramsMediumSliding WindowLeetCode
4Permutation in StringAnagramsMediumSliding WindowLeetCode
5Minimum Number of Steps to Make Two Strings AnagramAnagramsMediumHashMapLeetCode
6Minimum Number of Steps to Make Two Strings Anagram IIAnagramsMediumHashMapLeetCode
7Find Resultant Array After Removing AnagramsAnagramsMediumHashMap + SortingLeetCode
8Check if Two String Arrays are EquivalentAnagramsEasyHashMapLeetCode
9String Matching in an ArrayAnagramsEasyHashSetLeetCode
10Find AnagramsAnagramsMediumSliding WindowLeetCode
11Minimum Window SubstringAnagramsHardSliding WindowLeetCode
12Group Shifted StringsAnagramsMediumHashMapLeetCode
13Isomorphic StringsAnagramsEasyHashMapLeetCode
14Word PatternAnagramsEasyHashMapLeetCode
15Longest Substring with At Least K Repeating CharactersAnagramsMediumSliding WindowLeetCode

Pattern 4: Pattern Matching

IndexProblemPatternDifficultyAlgorithmSolveQuestion Link
1Regular Expression MatchingPattern MatchingHardDPLeetCode
2Wildcard MatchingPattern MatchingHardDPLeetCode
3Word PatternPattern MatchingEasyHashMapLeetCode
4Isomorphic StringsPattern MatchingEasyHashMapLeetCode
5Longest Common PrefixPattern MatchingEasyVertical ScanningLeetCode
6Shortest PalindromePattern MatchingHardKMP AlgorithmLeetCode
7Repeated Substring PatternPattern MatchingEasyKMP AlgorithmLeetCode
8Implement strStr()Pattern MatchingEasyKMP AlgorithmLeetCode
9Minimum Window SubstringPattern MatchingHardSliding WindowLeetCode
10Find All Anagrams in a StringPattern MatchingMediumSliding WindowLeetCode
11Word BreakPattern MatchingMediumDPLeetCode
12Word Break IIPattern MatchingHardDP + BacktrackingLeetCode
13Longest Valid ParenthesesPattern MatchingHardStackLeetCode
14Minimum Add to Make Parentheses ValidPattern MatchingMediumStackLeetCode
15Valid Parenthesis StringPattern MatchingMediumStackLeetCode

Chapter 8: Backtracking

Sub-Topics (Patterns): Permutations, Combinations, Subsets, N-Queens

Pattern 1: Permutations

IndexProblemPatternDifficultyAlgorithmSolveQuestion Link
1PermutationsPermutationsMediumBacktrackingLeetCode
2Permutations IIPermutationsMediumBacktrackingLeetCode
3Next PermutationPermutationsMediumIterativeLeetCode
4Permutation SequencePermutationsHardMath + BacktrackingLeetCode
5Permutation in StringPermutationsMediumSliding WindowLeetCode
6Letter Combinations of a Phone NumberPermutationsMediumBacktrackingLeetCode
7Generate ParenthesesPermutationsMediumBacktrackingLeetCode
8Palindrome PartitioningPermutationsMediumBacktrackingLeetCode
9Combination SumPermutationsMediumBacktrackingLeetCode
10Combination Sum IIPermutationsMediumBacktrackingLeetCode
11Combination Sum IIIPermutationsMediumBacktrackingLeetCode
12Combination Sum IVPermutationsMediumDPLeetCode
13Permutations of a StringPermutationsMediumBacktrackingGeeksforGeeks
14Letter Case PermutationPermutationsMediumBacktrackingLeetCode
15All Possible Full Binary TreesPermutationsMediumBacktrackingLeetCode

Pattern 2: Combinations

IndexProblemPatternDifficultyAlgorithmSolveQuestion Link
1CombinationsCombinationsMediumBacktrackingLeetCode
2Combination SumCombinationsMediumBacktrackingLeetCode
3Combination Sum IICombinationsMediumBacktrackingLeetCode
4Combination Sum IIICombinationsMediumBacktrackingLeetCode
5Combination Sum IVCombinationsMediumDPLeetCode
6Letter Combinations of a Phone NumberCombinationsMediumBacktrackingLeetCode
7SubsetsCombinationsMediumBacktrackingLeetCode
8Subsets IICombinationsMediumBacktrackingLeetCode
9Factor CombinationsCombinationsMediumBacktrackingLeetCode
10Generate ParenthesesCombinationsMediumBacktrackingLeetCode
11Combination IteratorCombinationsMediumBacktrackingLeetCode
12Combinations of a StringCombinationsMediumBacktrackingGeeksforGeeks
13All Possible Full Binary TreesCombinationsMediumBacktrackingLeetCode
14Palindrome PartitioningCombinationsMediumBacktrackingLeetCode
15K-Sum SubsetsCombinationsHardBacktrackingLeetCode

Pattern 3: Subsets

IndexProblemPatternDifficultyAlgorithmSolveQuestion Link
1SubsetsSubsetsMediumBacktrackingLeetCode
2Subsets IISubsetsMediumBacktrackingLeetCode
3Combination SumSubsetsMediumBacktrackingLeetCode
4Combination Sum IISubsetsMediumBacktrackingLeetCode
5Combination Sum IIISubsetsMediumBacktrackingLeetCode
6Partition Equal Subset SumSubsetsMediumDPLeetCode
7Subset Sum ProblemSubsetsMediumDPGeeksforGeeks
8Generalized AbbreviationSubsetsMediumBacktrackingLeetCode
9Letter Case PermutationSubsetsMediumBacktrackingLeetCode
10Partition to K Equal Sum SubsetsSubsetsMediumBacktrackingLeetCode
11Count Number of Maximum Bitwise-OR SubsetsSubsetsMediumBacktrackingLeetCode
12Subarrays with K Different IntegersSubsetsHardSliding WindowLeetCode
13All Subsets of a StringSubsetsMediumBacktrackingGeeksforGeeks
14Maximum Subarray Sum with One DeletionSubsetsMediumDPLeetCode
15Count Number of Nice SubarraysSubsetsMediumSliding WindowLeetCode

Pattern 4: N-Queens

IndexProblemPatternDifficultyAlgorithmSolveQuestion Link
1N-QueensN-QueensHardBacktrackingLeetCode
2N-Queens IIN-QueensHardBacktrackingLeetCode
3Sudoku SolverN-QueensHardBacktrackingLeetCode
4Valid SudokuN-QueensMediumHashSetLeetCode
5Word SearchN-QueensMediumBacktrackingLeetCode
6Word Search IIN-QueensHardBacktracking + TrieLeetCode
7Generate ParenthesesN-QueensMediumBacktrackingLeetCode
8Palindrome PartitioningN-QueensMediumBacktrackingLeetCode
9Combination SumN-QueensMediumBacktrackingLeetCode
10Letter Combinations of a Phone NumberN-QueensMediumBacktrackingLeetCode
11Restore IP AddressesN-QueensMediumBacktrackingLeetCode
12SubsetsN-QueensMediumBacktrackingLeetCode
13PermutationsN-QueensMediumBacktrackingLeetCode
14Combination Sum IIN-QueensMediumBacktrackingLeetCode
15Solve the SudokuN-QueensHardBacktrackingGeeksforGeeks

Chapter 9: Greedy

Sub-Topics (Patterns): Interval Scheduling, Minimum Operations, Greedy Choice

Pattern 1: Interval Scheduling

IndexProblemPatternDifficultyAlgorithmSolveQuestion Link
1Non-overlapping IntervalsInterval SchedulingMediumGreedyLeetCode
2Meeting RoomsInterval SchedulingEasyGreedyLeetCode
3Meeting Rooms IIInterval SchedulingMediumGreedy + Min HeapLeetCode
4Minimum Number of Arrows to Burst BalloonsInterval SchedulingMediumGreedyLeetCode
5Maximum Length of Pair ChainInterval SchedulingMediumGreedyLeetCode
6Interval List IntersectionsInterval SchedulingMediumTwo PointersLeetCode
7Merge IntervalsInterval SchedulingMediumGreedyLeetCode
8Insert IntervalInterval SchedulingMediumGreedyLeetCode
9Employee Free TimeInterval SchedulingHardGreedy + Min HeapLeetCode
10Partition LabelsInterval SchedulingMediumGreedyLeetCode
11Minimum Number of Taps to Open to Water a GardenInterval SchedulingHardGreedyLeetCode
12Minimum Interval to Include Each QueryInterval SchedulingHardGreedy + Min HeapLeetCode
13Maximum Number of Events That Can Be AttendedInterval SchedulingMediumGreedy + Min HeapLeetCode
14Maximum Number of Events That Can Be Attended IIInterval SchedulingHardDP + GreedyLeetCode
15Data Stream as Disjoint IntervalsInterval SchedulingHardGreedy + TreeSetLeetCode

Pattern 2: Minimum Operations

IndexProblemPatternDifficultyAlgorithmSolveQuestion Link
1Minimum Operations to Reduce X to ZeroMinimum OperationsMediumSliding WindowLeetCode
2Minimum Moves to Equal Array ElementsMinimum OperationsEasyGreedyLeetCode
3Minimum Moves to Equal Array Elements IIMinimum OperationsMediumGreedyLeetCode
4Minimum Operations to Make Array EqualMinimum OperationsMediumGreedyLeetCode
5Minimum Number of Steps to Make Two Strings AnagramMinimum OperationsMediumHashMapLeetCode
6Minimum Deletions to Make Character Frequencies UniqueMinimum OperationsMediumGreedy + HashMapLeetCode
7Minimum Increment to Make Array UniqueMinimum OperationsMediumGreedyLeetCode
8Minimum Operations to Make a SubsequenceMinimum OperationsHardGreedy + Binary SearchLeetCode
9Minimum Number of Operations to Move All Balls to Each BoxMinimum OperationsMediumGreedyLeetCode
10Minimum Deletion Cost to Avoid Repeating LettersMinimum OperationsMediumGreedyLeetCode
11Minimum Operations to Make the Array IncreasingMinimum OperationsEasyGreedyLeetCode
12Minimum Changes to Make Alternating Binary StringMinimum OperationsEasyGreedyLeetCode
13Minimum Operations to Make Array AlternatingMinimum OperationsMediumGreedyLeetCode
14Minimum Cost to Make Array EqualMinimum OperationsHardGreedy + Binary SearchLeetCode
15Minimum Operations to Remove Adjacent Equal ElementsMinimum OperationsMediumGreedyLeetCode

Pattern 3: Greedy Choice

IndexProblemPatternDifficultyAlgorithmSolveQuestion Link
1Jump GameGreedy ChoiceMediumGreedyLeetCode
2Jump Game IIGreedy ChoiceMediumGreedyLeetCode
3Gas StationGreedy ChoiceMediumGreedyLeetCode
4CandyGreedy ChoiceHardGreedyLeetCode
5Partition LabelsGreedy ChoiceMediumGreedyLeetCode
6Queue Reconstruction by HeightGreedy ChoiceMediumGreedyLeetCode
7Reorganize StringGreedy ChoiceMediumGreedy + HeapLeetCode
8Task SchedulerGreedy ChoiceMediumGreedy + HeapLeetCode
9Minimum Number of Taps to Open to Water a GardenGreedy ChoiceHardGreedyLeetCode
10Maximum SubarrayGreedy ChoiceMediumKadane’sLeetCode
11Best Time to Buy and Sell StockGreedy ChoiceEasyGreedyLeetCode
12Best Time to Buy and Sell Stock IIGreedy ChoiceMediumGreedyLeetCode
13Lemonade ChangeGreedy ChoiceEasyGreedyLeetCode
14Minimum Cost to Connect SticksGreedy ChoiceMediumGreedy + HeapLeetCode
15Maximum Units on a TruckGreedy ChoiceEasyGreedyLeetCode

Sub-Topics (Patterns): Standard Binary Search, Search in Rotated Array, Find Peak/Valley

IndexProblemPatternDifficultyAlgorithmSolveQuestion Link
1Binary SearchStandard Binary SearchEasyBinary SearchLeetCode
2Search Insert PositionStandard Binary SearchEasyBinary SearchLeetCode
3First Bad VersionStandard Binary SearchEasyBinary SearchLeetCode
4Find Peak ElementStandard Binary SearchMediumBinary SearchLeetCode
5Search a 2D MatrixStandard Binary SearchMediumBinary SearchLeetCode
6Search a 2D Matrix IIStandard Binary SearchMediumBinary SearchLeetCode
7Find First and Last Position of Element in Sorted ArrayStandard Binary SearchMediumBinary SearchLeetCode
8Kth Smallest Element in a Sorted MatrixStandard Binary SearchMediumBinary SearchLeetCode
9Sqrt(x)Standard Binary SearchEasyBinary SearchLeetCode
10Find Minimum in Rotated Sorted ArrayStandard Binary SearchMediumBinary SearchLeetCode
11Capacity To Ship Packages Within D DaysStandard Binary SearchMediumBinary SearchLeetCode
12Koko Eating BananasStandard Binary SearchMediumBinary SearchLeetCode
13Find the Smallest Divisor Given a ThresholdStandard Binary SearchMediumBinary SearchLeetCode
14Split Array Largest SumStandard Binary SearchHardBinary SearchLeetCode
15Median of Two Sorted ArraysStandard Binary SearchHardBinary SearchLeetCode

Pattern 2: Search in Rotated Array

IndexProblemPatternDifficultyAlgorithmSolveQuestion Link
1Search in Rotated Sorted ArraySearch in Rotated ArrayMediumBinary SearchLeetCode
2Search in Rotated Sorted Array IISearch in Rotated ArrayMediumBinary SearchLeetCode
3Find Minimum in Rotated Sorted ArraySearch in Rotated ArrayMediumBinary SearchLeetCode
4Find Minimum in Rotated Sorted Array IISearch in Rotated ArrayHardBinary SearchLeetCode
5Search a 2D MatrixSearch in Rotated ArrayMediumBinary SearchLeetCode
6Find First and Last Position of Element in Sorted ArraySearch in Rotated ArrayMediumBinary SearchLeetCode
7Single Element in a Sorted ArraySearch in Rotated ArrayMediumBinary SearchLeetCode
8Find Peak ElementSearch in Rotated ArrayMediumBinary SearchLeetCode
9Search in a Sorted Array of Unknown SizeSearch in Rotated ArrayMediumBinary SearchLeetCode
10Find K Closest ElementsSearch in Rotated ArrayMediumBinary SearchLeetCode
11Peak Index in a Mountain ArraySearch in Rotated ArrayEasyBinary SearchLeetCode
12Find the Duplicate NumberSearch in Rotated ArrayMediumBinary SearchLeetCode
13Find Minimum in Rotated Sorted Array with DuplicatesSearch in Rotated ArrayHardBinary SearchLeetCode
14Search for a RangeSearch in Rotated ArrayMediumBinary SearchLeetCode
15Time Based Key-Value StoreSearch in Rotated ArrayMediumBinary SearchLeetCode

Pattern 3: Find Peak/Valley

IndexProblemPatternDifficultyAlgorithmSolveQuestion Link
1Find Peak ElementFind Peak/ValleyMediumBinary SearchLeetCode
2Peak Index in a Mountain ArrayFind Peak/ValleyEasyBinary SearchLeetCode
3Find Minimum in Rotated Sorted ArrayFind Peak/ValleyMediumBinary SearchLeetCode
4Find Minimum in Rotated Sorted Array IIFind Peak/ValleyHardBinary SearchLeetCode
5Single Element in a Sorted ArrayFind Peak/ValleyMediumBinary SearchLeetCode
6Find K Closest ElementsFind Peak/ValleyMediumBinary SearchLeetCode
7Search in Rotated Sorted ArrayFind Peak/ValleyMediumBinary SearchLeetCode
8Find the Duplicate NumberFind Peak/ValleyMediumBinary SearchLeetCode
9Longest Mountain in ArrayFind Peak/ValleyMediumTwo PointersLeetCode
10Valid Mountain ArrayFind Peak/ValleyEasyTwo PointersLeetCode
11Kth Smallest Number in Multiplication TableFind Peak/ValleyHardBinary SearchLeetCode
12Find in Mountain ArrayFind Peak/ValleyHardBinary SearchLeetCode
13Capacity To Ship Packages Within D DaysFind Peak/ValleyMediumBinary SearchLeetCode
14Koko Eating BananasFind Peak/ValleyMediumBinary SearchLeetCode
15Split Array Largest SumFind Peak/ValleyHardBinary SearchLeetCode

How to Use This Sheet

  1. Schedule: Follow the 3-month plan outlined in the previous response, allocating ~2-3 weeks per chapter. Start with easier problems (Easy/Medium) in Month 1, progress to Medium/Hard in Month 2, and focus on Hard + revision in Month 3.
  2. Problem Selection: The 15 problems per pattern are curated to cover most variations of the pattern, ensuring comprehensive preparation. Solve them in order, starting with easier ones to build confidence.
  3. Tracking: Use the "Solve" column to mark completed problems. Revisit unsolved or challenging problems weekly.
  4. Resources: Pair problem-solving with conceptual learning (e.g., NeetCode videos, GeeksforGeeks articles, or "Cracking the Coding Interview").
  5. Mock Interviews: In Month 3, practice these problems under timed conditions (20-25 minutes for Medium, 30-40 minutes for Hard) to simulate MNC interview scenarios.

Additional Notes

  • Total Problems: ~600 problems across all chapters and patterns, covering most DSA concepts asked in MNC interviews.
  • Company-Specific Prep: For companies like Google, Amazon, or Microsoft, check LeetCode’s company-tagged questions or Glassdoor for recent patterns.
  • Time Management: Aim to solve 3-5 problems daily, balancing learning and practice. Use weekends for contests (e.g., LeetCode Weekly) and revision.

If you need a specific chapter expanded, a weekly schedule, or additional problems for a particular pattern, let me know!

Share this article

Enjoying this post?

Don't miss out 😉. Get an email whenever I post, no spam.

Subscribe Now