Grokking-the-Coding-Interview-Patterns-for-Coding-Questions

1. Pattern: Sliding Window

  • Maximum Sum Subarray of Size K (easy)
  • Smallest Subarray with a given sum (easy)
  • Longest Substring with K Distinct Characters (medium)
  • Fruits into Baskets (medium)
  • No-repeat Substring (hard) *
  • Longest Substring with Same Letters after Replacement (hard)
  • Longest Subarray with Ones after Replacement (hard) *
  • Problem Challenge 1 - Permutation in a String (hard) *
  • Problem Challenge 2 - String Anagrams (hard)
  • Problem Challenge 3 - Smallest Window containing Substring (hard) *
  • Problem Challenge 4 - Words Concatenation (hard)

2. Pattern: Two Pointers

  • Pair with Target Sum (easy)
  • Remove Duplicates (easy)
  • Squaring a Sorted Array (easy)
  • Triplet Sum to Zero (medium)
  • Triplet Sum Close to Target (medium)
  • Triplets with Smaller Sum (medium)
  • Subarrays with Product Less than a Target (medium) *
  • Problem Challenge 1 - Quadruple Sum to Target (medium) *
  • Problem Challenge 2 - Comparing Strings containing Backspaces (medium)
  • Problem Challenge 3 - Minimum Window Sort (medium) *

3. Pattern: Fast & Slow pointers

  • LinkedList Cycle (easy)
  • Middle of the LinkedList (easy)
  • Start of LinkedList Cycle (medium) *
  • Happy Number (medium) *
  • Problem Challenge 1 - Palindrome LinkedList (medium) *
  • Problem Challenge 2 - Rearrange a LinkedList (medium)
  • Problem Challenge 3 - Cycle in a Circular Array (hard) *

4. Pattern: Merge Intervals

  • Merge Intervals (medium)
  • Insert Interval (medium) *
  • Intervals Intersection (medium)
  • Conflicting Appointments (medium)
  • Problem Challenge 1 - Minimum Meeting Rooms (hard) *
  • Problem Challenge 2 - Maximum CPU Load (hard)
  • Problem Challenge 3 - Employee Free Time (hard) *

5.Pattern: Cyclic Sort

  • Cyclic Sort (easy)
  • Find the Missing Number (easy)
  • Find all Missing Numbers (easy)
  • Find the Duplicate Number (easy)
  • Find all Duplicate Numbers (easy)
  • Problem Challenge 1 - Find the Corrupt Pair (easy)
  • Problem Challenge 2 - Find the Smallest Missing Positive Number (medium)
  • Problem Challenge 3 - Find the First K Missing Positive Numbers (hard) *

6. Pattern: In-place Reversal of a LinkedList

  • Reverse a LinkedList (easy)
  • Reverse a Sub-list (medium)
  • Reverse every K-element Sub-list (medium) *
  • Problem Challenge 1 - Reverse alternating K-element Sub-list (medium)
  • Problem Challenge 2 - Rotate a LinkedList (medium)

7. Pattern: Tree Breadth First Search

  • Binary Tree Level Order Traversal (easy)
  • Reverse Level Order Traversal (easy) *
  • Zigzag Traversal (medium)
  • Level Averages in a Binary Tree (easy)
  • Minimum Depth of a Binary Tree (easy)
  • Level Order Successor (easy)
  • Connect Level Order Siblings (medium)
  • Problem Challenge 1 - Connect All Level Order Siblings (medium)
  • Problem Challenge 2 - Right View of a Binary Tree (easy)

8. Pattern: Tree Depth First Search

  • Binary Tree Path Sum (easy)
  • All Paths for a Sum (medium) *
  • Sum of Path Numbers (medium)
  • Path With Given Sequence (medium) *
  • Count Paths for a Sum (medium)
  • Problem Challenge 1 - Tree Diameter (medium) *
  • Problem Challenge 2 - Path with Maximum Sum (hard) *

9. Pattern: Two Heaps

  • Find the Median of a Number Stream (medium)
  • Sliding Window Median (hard) *
  • Maximize Capital (hard) *
  • Problem Challenge 1 - Next Interval (hard)

10. Pattern: Subsets

  • Subsets (easy)
  • Subsets With Duplicates (easy) *
  • Permutations (medium) *
  • String Permutations by changing case (medium)
  • Balanced Parentheses (hard) *
  • Unique Generalized Abbreviations (hard) *
  • Problem Challenge 1 - Evaluate Expression (hard) *
  • Problem Challenge 2 - Structurally Unique Binary Search Trees (hard) *
  • Problem Challenge 3 - Count of Structurally Unique Binary Search Trees (hard)

11. Pattern: Modified Binary Search

  • Order-agnostic Binary Search (easy)
  • Ceiling of a Number (medium) *
  • Next Letter (medium)
  • Number Range (medium) *
  • Search in a Sorted Infinite Array (medium) *
  • Minimum Difference Element (medium)
  • Bitonic Array Maximum (easy)
  • Problem Challenge 1 - Search Bitonic Array (medium)
  • Problem Challenge 2 - Search in Rotated Array (medium) *
  • Problem Challenge 3 - Rotation Count (medium) *

12. Pattern: Bitwise XOR

  • Single Number (easy)
  • Two Single Numbers (medium) *
  • Complement of Base 10 Number (medium)
  • Problem Challenge 1

13. Pattern Top 'K' Elements

  • Top 'K' Numbers (easy)
  • Kth Smallest Number (easy)
  • 'K' Closest Points to the Origin (easy)
  • Connect Ropes (easy) *
  • Top 'K' Frequent Numbers (medium)
  • Frequency Sort (medium) *
  • Kth Largest Number in a Stream (medium)
  • 'K' Closest Numbers (medium)
  • Maximum Distinct Elements (medium)
  • Sum of Elements (medium)
  • Rearrange String (hard)
  • Problem Challenge 1 - Rearrange String K Distance Apart (hard)
  • Problem Challenge 2 - Scheduling Tasks (hard) *
  • Problem Challenge 3 - Frequency Stack (hard)

14. Pattern: K-way merge

  • Merge K Sorted Lists (medium) *
  • Kth Smallest Number in M Sorted Lists (Medium)
  • Kth Smallest Number in a Sorted Matrix (Hard) *
  • Smallest Number Range (Hard) *
  • Problem Challenge 1 - K Pairs with Largest Sums (Hard)

15. Pattern : 0/1 Knapsack (Dynamic Programming)

  • 0/1 Knapsack (medium)
  • Equal Subset Sum Partition (medium) *
  • Subset Sum (medium)
  • Minimum Subset Sum Difference (hard) *
  • Problem Challenge 1 - Count of Subset Sum (hard)
  • Problem Challenge 2 - Target Sum (hard)

16. Pattern: Topological Sort (Graph)

  • Topological Sort (medium) *
  • Tasks Scheduling (medium)
  • Tasks Scheduling Order (medium)
  • All Tasks Scheduling Orders (hard) *
  • Alien Dictionary (hard)
  • Problem Challenge 1 - Reconstructing a Sequence (hard) *
  • Problem Challenge 2 - Minimum Height Trees (hard) *

17. Miscellaneous

  • Kth Smallest Number (hard) *