Skip to content

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

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

75 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Coding Interview Patterns

Coding Interview Patterns

1. Pattern: Two Pointers

  1. Introduction
  2. Pair with Target Sum (easy) LeetCode
  3. Remove Duplicates (easy) LeetCode LeetCode LeetCode LeetCode LeetCode
  4. Squaring a Sorted Array (easy) LeetCode
  5. Triplet Sum to Zero (medium) LeetCode
  6. Triplet Sum Close to Target (medium) LeetCode
  7. Triplets with Smaller Sum (medium) LintCode
  8. Subarrays with Product Less than a Target (medium) LeetCode
  9. Dutch National Flag Problem (medium) CoderByte
  10. Problem Challenge 1: Quadruple Sum to Target (medium) Leetcode
  11. Problem Challenge 2: Comparing Strings containing Backspaces (medium) Leetcode
  12. Problem Challenge 3: Minimum Window Sort (medium) Leetcode Ideserve

2. Pattern: Fast & Slow pointers

  1. Introduction emre.me
  2. LinkedList Cycle (easy) Leetcode
  3. Start of LinkedList Cycle (medium) Leetcode
  4. Happy Number (medium) Leetcode
  5. Middle of the LinkedList (easy) Leetcode
  6. Problem Challenge 1: Palindrome LinkedList (medium) Leetcode
  7. Problem Challenge 2: Rearrange a LinkedList (medium) Leetcode
  8. Problem Challenge 3: Cycle in a Circular Array (hard) Leetcode

3. Pattern: Sliding Window

  1. Introduction
  2. Maximum Sum Subarray of Size K (easy)
  3. Smallest Subarray with a given sum (easy) Educative.io
  4. Longest Substring with K Distinct Characters (medium) Educative.io
  5. Fruits into Baskets (medium) LeetCode
  6. No-repeat Substring (hard) LeetCode
  7. Longest Substring with Same Letters after Replacement (hard) LeetCode
  8. Longest Subarray with Ones after Replacement (hard) LeetCode
  9. Problem Challenge 1: Permutation in a String (hard) Leetcode
  10. Problem Challenge 2: String Anagrams (hard) Leetcode
  11. Problem Challenge 3: Smallest Window containing Substring (hard) Leetcode
  12. Problem Challenge 4: Words Concatenation (hard) Leetcode

4. Pattern: Merge Intervals

  1. Introduction Educative.io
  2. Merge Intervals (medium) Educative.io
  3. Insert Interval (medium) Educative.io
  4. Intervals Intersection (medium) Educative.io
  5. Conflicting Appointments (medium) Geeksforgeeks
  6. Problem Challenge 1: Minimum Meeting Rooms (hard) Lintcode
  7. Problem Challenge 2: Maximum CPU Load (hard) Geeksforgeeks
  8. Problem Challenge 3: Employee Free Time (hard) CoderTrain

5. Pattern: Cyclic Sort

  1. Introduction emre.me
  2. Cyclic Sort (easy) Geeksforgeeks
  3. Find the Missing Number (easy) Leetcode
  4. Find all Missing Numbers (easy) Leetcode
  5. Find the Duplicate Number (easy) Leetcode
  6. Find all Duplicate Numbers (easy) Leetcode
  7. Problem Challenge 1: Find the Corrupt Pair (easy) TheCodingSimplified
  8. Problem Challenge 2: Find the Smallest Missing Positive Number (medium) Leetcode
  9. Problem Challenge 3: Find the First K Missing Positive Numbers (hard) TheCodingSimplified

6. Pattern: In-place Reversal of a LinkedList

  1. Introduction emre.me
  2. Reverse a LinkedList (easy) Leetcode
  3. Reverse a Sub-list (medium) Leetcode
  4. Reverse every K-element Sub-list (medium) Leetcode
  5. Problem Challenge 1: Reverse alternating K-element Sub-list (medium) Geeksforgeeks
  6. Problem Challenge 2: Rotate a LinkedList (medium) Leetcode

7. Pattern: Stack

  1. Introduction to Stack (Operations, Implementation, Applications)
  2. Balanced Parentheses
  3. Reverse a String
  4. Decimal to Binary Conversion
  5. Next Greater Element Leetcode - I Leetcode -II Leetcode - III (Hard)
  6. Sorting a Stack
  7. Simplify Path Leetcode

8. Pattern: Monotonic Stack

  1. Introduction to Monotonic Stack
  2. Next Greater Element (easy) Leetcode - I Leetcode -II Leetcode - III (Hard)
  3. Daily Temperatures (easy) Leetcode
  4. Remove Nodes From Linked List (easy) Leetcode
  5. Remove All Adjacent Duplicates In String (easy) Leetcode
  6. Remove All Adjacent Duplicates in String II (medium) Leetcode
  7. Remove K Digits (hard) Leetcode

9. Pattern: Hash Maps

  1. Introduction (Hashing, Hash Tables, Issues)
  2. First Non-repeating Character (easy) Leetcode
  3. Largest Unique Number (easy) Leetcode+
  4. Maximum Number of Balloons (easy) Leetcode
  5. Longest Palindrome(easy) Leetcode
  6. Ransom Note (easy) Leetcode

10. Pattern: Tree Breadth First Search

  1. Introduction
  2. Binary Tree Level Order Traversal (easy) Leetcode
  3. Reverse Level Order Traversal (easy) Leetcode
  4. Zigzag Traversal (medium) Leetcode
  5. Level Averages in a Binary Tree (easy) Leetcode
  6. Minimum Depth of a Binary Tree (easy) Leetcode
  7. Maximum Depth of a Binary Tree (easy) Leetcode
  8. Level Order Successor (easy) Geeksforgeeks
  9. Connect Level Order Siblings (medium) Leetcode
  10. Problem Challenge 1: Connect All Level Order Siblings (medium) Educative
  11. Problem Challenge 2: Right View of a Binary Tree (easy) Leetcode

11. Pattern: Tree Depth First Search

  1. Introduction
  2. Binary Tree Path Sum (easy) Leetcode
  3. All Paths for a Sum (medium) Leetcode
  4. Sum of Path Numbers (medium) Leetcode
  5. Path With Given Sequence (medium) Geeksforgeeks
  6. Count Paths for a Sum (medium) Leetcode
  7. Problem Challenge 1: Tree Diameter (medium) Leetcode
  8. Problem Challenge 2: Path with Maximum Sum (hard) Leetcode

12. Pattern: Graphs

  1. Introduction to Graph (Representations, Abstract Data Type (ADT))
  2. Graph Traversal: Depth First Search(DFS)
  3. Graph Traversal: Breadth First Search (BFS)
  4. Find if Path Exists in Graph(easy) Leetcode
  5. Number of Provinces (medium) Leetcode
  6. Minimum Number of Vertices to Reach All Nodes(medium) Leetcode

13. Pattern: Island (Matrix traversal)

  1. Introduction to Island Pattern
  2. Number of Islands (easy) Leetcode
  3. Biggest Island (easy)
  4. Flood Fill (easy) Leetcode
  5. Number of Closed Islands (easy) Leetcode
  6. Problem Challenge 1 (easy)
  7. Problem Challenge 2 (medium)
  8. Problem Challenge 3 (medium)

14. Pattern: Two Heaps

  1. Introduction

  2. Find the Median of a Number Stream (medium) Leetcode

  3. Sliding Window Median (hard) Leetcode

  4. Maximize Capital (hard) Leetcode

  5. *Maximum Sum Combinations (medium) InterviewBit

15. Pattern: Subsets

  1. Introduction Educative.io
  2. Subsets (easy) Educative.io
  3. Subsets With Duplicates (easy) Educative.io
  4. Permutations (medium) Educative.io
  5. String Permutations by changing case (medium)
  6. Balanced Parentheses (hard)
  7. Unique Generalized Abbreviations (hard) Leetcode
  1. Introduction Complete Pattern Theory and Solutions
  2. Order-agnostic Binary Search (easy) Geeksforgeeks
  3. Ceiling of a Number (medium) Geeksforgeeks-Ceil Geeksforgeeks-Floor
  4. Next Letter (medium) Leetcode
  5. Number Range (medium) Leetcode
  6. Search in a Sorted Infinite Array (medium) Leetcode
  7. Minimum Difference Element (medium): Find the floor & ceil take the difference, minimum would be the ans
  8. Bitonic Array Maximum (easy) Geeksforgeeks
  9. Problem Challenge 1: Search Bitonic Array (medium) Leetcode
  10. Problem Challenge 2: Search in Rotated Array (medium) Leetcode
  11. Problem Challenge 3: Rotation Count (medium) Geeksforgeeks
  12. *Search a 2D Matrix (medium) Leetcode
  13. *Minimum Number of Days to Make m Bouquets (medium) Leetcode
  14. *Koko Eating Bananas (medium) Leetcode
  15. *Capacity To Ship Packages Within D Days (medium) Leetcode
  16. *Median of Two Sorted Arrays (hard) Leetcode

17. Pattern: Bitwise XOR

  1. Introduction
  2. Single Number (easy)
  3. Two Single Numbers (medium)
  4. Complement of Base 10 Number (medium)
  5. Problem Challenge 1: Flip and Invert an Image (hard)

18. Pattern: Top 'K' Elements

  1. Introduction

  2. Top 'K' Numbers (easy) Solution

  3. Kth Smallest Number (easy)

  4. 'K' Closest Points to the Origin (easy) Leetcode

  5. Connect Ropes (easy)

  6. Top 'K' Frequent Numbers (medium)

  7. Frequency Sort (medium)

  8. Kth Largest Number in a Stream (medium) Leetcode

  9. 'K' Closest Numbers (medium)

  10. Maximum Distinct Elements (medium)

  11. Sum of Elements (medium)

  12. Rearrange String (hard)

  13. Problem Challenge 1: Rearrange String K Distance Apart (hard)

  14. Problem Challenge 2: Scheduling Tasks (hard)

  15. Problem Challenge 3: Frequency Stack (hard)

  16. *Heap Implementation

19. Pattern: K-way merge

  1. Introduction
  2. Merge K Sorted Lists (medium) Leetcode
  3. Kth Smallest Number in M Sorted Lists (Medium) Geeksforgeeks
  4. Kth Smallest Number in a Sorted Matrix (Hard) Educative.io
  5. Smallest Number Range (Hard) Leetcode
  6. Problem Challenge 1: K Pairs with Largest Sums (hard)

20. Pattern: Greedy Algorithms

  1. Introduction to Greedy Algorithm
  2. Valid Palindrome II (easy) Leetcode
  3. Maximum Length of Pair Chain (medium) Leetcode
  4. Minimum Add to Make Parentheses Valid (medium) Leetcode
  5. Remove Duplicate Letters (medium) Leetcode
  6. Largest Palindromic Number (Medium) Leetcode
  7. Removing Minimum and Maximum From Array (medium) Leetcode

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

  1. Introduction
  2. 0/1 Knapsack (medium) Geeksforgeeks
  3. Equal Subset Sum Partition (medium) Leetcode
  4. Subset Sum (medium) Geeksforgeeks
  5. Minimum Subset Sum Difference (hard) Geeksforgeeks
  6. Problem Challenge 1: Count of Subset Sum (hard)
  7. Problem Challenge 2: Target Sum (hard)

22. Pattern: Backtracking

  1. Introduction to Backtracking Pattern
  2. Combination Sum (medium) Leetcode - I Leetcode - II Leetcode - III Leetcode - IV
  3. Word Search (medium) Leetcode - I Leetcode - II (Hard)
  4. Sudoku Solver (hard) Leetcode
  5. Factor Combinations (medium) Leetcode+
  6. Split a String Into the Max Number of Unique Substrings (medium) Leetcode

23. Pattern: Trie

  1. Introduction to Trie
  2. Implement Trie (Prefix Tree) (medium) Leetcode
  3. Index Pairs of a String (easy) Leetcode+
  4. Design Add and Search Words Data Structure (medium) Leetcode
  5. Extra Characters in a String (medium) Leetcode
  6. Search Suggestions System (medium) Leetcode

24. Pattern: Topological Sort (Graph)

  1. Introduction
  2. Topological Sort (medium) Youtube
  3. Tasks Scheduling (medium) Leetcode-Similar
  4. Tasks Scheduling Order (medium) Leetcode-Similar
  5. All Tasks Scheduling Orders (hard) Leetcode-Similar
  6. Alien Dictionary (hard) Leetcode
  7. Problem Challenge 1: Reconstructing a Sequence (hard) Leetcode
  8. Problem Challenge 2: Minimum Height Trees (hard) Leetcode

25. Pattern: Union Find

  1. Introduction to Union Find Pattern
  2. Redundant Connection (medium) Leetcode - I Leetcode - II (Hard)
  3. Number of Provinces (medium) Leetcode
  4. Is Graph Bipartite? (medium) Leetcode
  5. Path With Minimum Effort (medium) Leetcode

26. Ordered Set

  1. Introduction to Ordered Set Pattern
  2. Merge Similar Items (easy) Leetcode
  3. 132 Pattern (medium) Leetcode
  4. My Calendar I (medium) Leetcode Leetcode - II Leetcode - III (Hard)
  5. Longest Continuous Subarray (medium)

27. Pattern: Multi-thread

  1. Introduction to Multi-threaded Pattern
  2. Same Tree (medium)
  3. Invert Binary Tree (medium)
  4. Binary Search Tree Iterator (medium)

28. Miscellaneous

  1. Kth Smallest Number (hard)

Revision

  1. Coding Patterns: A Cheat Sheet

Test Your Knowledge

  1. Easy Problems
  2. Medium Problems
  3. Hard Problems

Note: Problems marked with * are added as per my recommendations.