coderz.py

Keep Coding Keep Cheering!

23 DSA Patterns

The extended list with three problems under each difficulty level (Easy, Medium, Hard) for each DSA pattern:

Disclaimer: All the problems links will redirect you to leetcode, few problems are only accessible for premium users on leetcode.

1. Sliding Window

No.ProblemLevelResource
1.Maximum Sum of Two Non-Overlapping SubarraysEasy
2.Longest Substring Without Repeating CharactersEasy
3.Grumpy Bookstore OwnerEasy
4.Minimum Window SubstringMedium
5.Longest Substring with At Least K Repeating CharactersMedium
6.Permutation in StringMedium
7.Substring with Concatenation of All WordsHard
8.Sliding Window MaximumHard
9.Longest Substring with At Most Two Distinct CharactersHard

2. Two Pointers

No.ProblemLevelResource
1.Two Sum II – Input Array Is SortedEasy
2.Remove Duplicates from Sorted ArrayEasy
3.Valid Palindrome IIEasy
4.3SumMedium
5.Container With Most WaterMedium
6.Subarray Product Less Than KMedium
7.Trapping Rain WaterHard
8.4SumHard
9.Shortest Word Distance IIHard

3. Fast & Slow Pointers

No.ProblemLevelResource
1.Linked List CycleEasy
2.Middle of the Linked ListEasy
3.Happy NumberEasy
4.Find the Duplicate NumberMedium
5.Remove Linked List ElementsMedium
6.Linked List Cycle IIMedium
7.Palindrome Linked ListHard
8.Reorder ListHard
9.Split Linked List in PartsHard

4. Merge Intervals

No.ProblemLevelResource
1.Merge Two Sorted ListsEasy
2.Interval List IntersectionsEasy
3.Minimum Number of Arrows to Burst BalloonsEasy
4.Merge IntervalsMedium
5.Insert IntervalMedium
6.Meeting Rooms IIMedium
7.Employee Free TimeHard
8.The Skyline ProblemHard
9.Minimum Cost to Hire K WorkersHard

5. Cyclic Sort

No.ProblemLevelResource
1.Find All Numbers Disappeared in an ArrayEasy
2.Find the Duplicate NumberEasy
3.Find All Duplicates in an ArrayEasy
4.Set MismatchMedium
5.First Missing PositiveMedium
6.Missing NumberMedium
7.First Missing PositiveHard
8.Find the Duplicate NumberHard
9.Find All Numbers Disappeared in an ArrayHard

6. In-place Reversal of a Linked List

No.ProblemLevelResource
1.Reverse Linked ListEasy
2.Reverse Linked List IIEasy
3.Palindrome Linked ListEasy
4.Reverse Nodes in k-GroupMedium
5.Swap Nodes in PairsMedium
6.Rotate ListMedium
7.Reverse Nodes in k-GroupHard
8.Reverse Linked List IIHard
9.Rotate ListHard

7. Tree BFS

No.ProblemLevelResource
1.Binary Tree Level Order TraversalEasy
2.Binary Tree Level Order Traversal IIEasy
3.Minimum Depth of Binary TreeEasy
4.Binary Tree Zigzag Level Order TraversalMedium
5.Binary Tree Right Side ViewMedium
6.Cousins in Binary TreeMedium
7.Word LadderHard
8.Cut Off Trees for Golf EventHard
9.Binary Tree Maximum Path SumHard

8. Tree DFS

No.ProblemLevelResource
1.Path SumEasy
2.Invert Binary TreeEasy
3.Diameter of Binary TreeEasy
4.Path Sum IIMedium
5.Binary Tree Longest Consecutive SequenceMedium
6.Binary Tree Maximum Path SumMedium
7.Binary Tree CamerasHard
8.Binary Tree Maximum Path SumHard
9.Path Sum IIIHard

9. Two Heaps

No.ProblemLevelResource
1.Last Stone WeightEasy
2.Kth Largest Element in a StreamEasy
3.Top K Frequent ElementsEasy
4.Find Median from Data StreamMedium
5.Sliding Window MedianMedium
6.IPO – LeetCodeMedium
7.Minimum Cost to Connect SticksHard
8.The Skyline ProblemHard
9.Find Median from Data StreamHard

10. Subsets

No.ProblemLevelResource
1.SubsetsEasy
2.Combination SumEasy
3.PermutationsEasy
4.Subsets IIMedium
5.Combination Sum IIMedium
6.Permutations IIMedium
7.Word SquaresHard
8.Palindrome Partitioning IIHard
9.Super PalindromesHard

11. Modified Binary Search

No.ProblemLevelResource
1.Search Insert PositionEasy
2.Guess Number Higher or LowerEasy
3.Find Smallest Letter Greater Than TargetEasy
4.Search in Rotated Sorted ArrayMedium
5.Find Peak ElementMedium
6.Search a 2D MatrixMedium
7.Median of Two Sorted ArraysHard
8.Split Array Largest SumHard
9.Find Minimum in Rotated Sorted Array IIHard

12. Top K Elements

No.ProblemLevelResource
1.Kth Largest Element in a StreamEasy
2.Top K Frequent ElementsEasy
3.Sort Characters By FrequencyEasy
4.Kth Largest Element in an ArrayMedium
5.Task SchedulerMedium
6.Top K Frequent WordsMedium
7.Smallest Range Covering Elements from K ListsHard
8.Sliding Window MedianHard
9.Find Median from Data StreamHard

13. K-way Merge

No.ProblemLevelResource
1.Merge Two Sorted ListsEasy
2.Merge Sorted ArrayEasy
3.Intersection of Two Arrays IIEasy
4.Merge k Sorted ListsMedium
5.Kth Smallest Element in a Sorted MatrixMedium
6.Find K Pairs with Smallest SumsMedium
7.Smallest Range Covering Elements from K ListsHard
8.Median of Two Sorted ArraysHard
9.Split Array Largest SumHard

14. Knapsack (Dynamic Programming)

No.ProblemLevelResource
1.Climbing StairsEasy
2.House RobberEasy
3.Partition Equal Subset SumEasy
4.Partition Equal Subset SumMedium
5.Coin ChangeMedium
6.Target SumMedium
7.Target SumHard
8.Coin Change 2Hard
9.Wildcard MatchingHard

15. Palindrome

No.ProblemLevelResource
1.Valid PalindromeEasy
2.Valid Palindrome IIEasy
3.Palindrome Linked ListEasy
4.Longest Palindromic SubstringMedium
5.Palindromic SubstringsMedium
6.Palindrome PartitioningMedium
7.Palindrome PairsHard
8.Longest Palindromic SubsequenceHard
9.Palindrome Partitioning IIHard

16. Topological Sort

No.ProblemLevelResource
1.Course ScheduleEasy
2.Course Schedule IIEasy
3.Find Eventual Safe StatesEasy
4.Course Schedule IIMedium
5.Alien DictionaryMedium
6.Minimum Height TreesMedium
7.Alien DictionaryHard
8.Sequence ReconstructionHard
9.Parallel CoursesHard

17. Trie

No.ProblemLevelResource
1.Implement Trie (Prefix Tree)Easy
2.Add and Search Word – Data structure designEasy
3.Design Add and Search Words Data StructureEasy
4.Word SearchMedium
5.Word Search IIMedium
6.Replace WordsMedium
7.Design Search Autocomplete SystemHard
8.Concatenated WordsHard
9.Longest Word in Dictionary through DeletingHard

18. Greedy Technique

No.ProblemLevelResource
1.Assign CookiesEasy
2.Two City SchedulingEasy
3.Is SubsequenceEasy
4.Jump GameMedium
5.Partition LabelsMedium
6.Queue Reconstruction by HeightMedium
7.CandyHard
8.Minimum Number of Refueling StopsHard
9.Minimum Cost to Hire K WorkersHard

19. Backtracking

No.ProblemLevelResource
1.Letter Combinations of a Phone NumberEasy
2.Generate ParenthesesEasySolution
3.SubsetsEasy
4.Subsets IIMedium
5.Combination SumMedium
6.PermutationsMedium
7.N-QueensHard
8.Sudoku SolverHard
9.Word Search IIHard

20. Dynamic Programming

No.ProblemLevelResource
1.House RobberEasy
2.Climbing StairsEasy
3.Best Time to Buy and Sell StockEasy
4.Longest Increasing SubsequenceMedium
5.Longest Common SubsequenceMedium
6.Coin ChangeMedium
7.Edit DistanceHard
8.Burst BalloonsHard
9.Regular Expression MatchingHard

21. Monotonic Stack

No.ProblemLevelResource
1.Next Greater Element IEasy
2.Next Greater Element IIEasy
3.Remove All Adjacent Duplicates in String IIEasy
4.Daily TemperaturesMedium
5.Asteroid CollisionMedium
6.Sum of Subarray MinimumsMedium
7.Largest Rectangle in HistogramHard
8.Trapping Rain WaterHard
9.Maximal RectangleHard

22. Bitwise XOR

No.ProblemLevelResource
1.Single NumberEasy
2.Missing NumberEasy
3.Number ComplementEasy
4.Find the Duplicate NumberMedium
5.Single Number IIMedium
6.Maximum XOR of Two Numbers in an ArrayMedium
7.Find the Smallest Divisor Given a ThresholdHard
8.Maximum XOR of Two Numbers in an ArrayHard
9.Concatenated WordsHard

23. Island (Matrix Traversal) Pattern

No.ProblemLevelResource
1.Flood FillEasy
2.Max Area of IslandEasy
3.Number of EnclavesEasy
4.Number of IslandsMedium
5.Surrounded RegionsMedium
6.Pacific Atlantic Water FlowMedium
7.Shortest BridgeHard
8.Cut Off Trees for Golf EventHard
9.Making A Large IslandHard

This expanded list provides a well-rounded set of problems across different difficulty levels, allowing you to practice each DSA pattern progressively.

Advertisement