# Grokking-the-Coding-Interview-Patterns-for-Coding-Questions **Repository Path**: lucasnan/Grokking-the-Coding-Interview-Patterns-for-Coding-Questions ## Basic Information - **Project Name**: Grokking-the-Coding-Interview-Patterns-for-Coding-Questions - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2021-08-21 - **Last Updated**: 2021-08-21 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Coding Interview Patterns ## Coding Interview Patterns ### 1. Pattern: Sliding Window 1. Introduction 2. Maximum Sum Subarray of Size K \(easy\) 3. Smallest Subarray with a given sum \(easy\) [Educative.io](https://www.educative.io/courses/grokking-the-coding-interview/7XMlMEQPnnQ) 4. Longest Substring with K Distinct Characters \(medium\) [Educative.io](https://www.educative.io/courses/grokking-the-coding-interview/YQQwQMWLx80) 5. Fruits into Baskets \(medium\) [LeetCode](https://leetcode.com/problems/fruit-into-baskets/) 6. No-repeat Substring \(hard\) [LeetCode](https://leetcode.com/problems/longest-substring-without-repeating-characters/) 7. Longest Substring with Same Letters after Replacement \(hard\) [LeetCode](https://leetcode.com/problems/longest-repeating-character-replacement/) 8. Longest Subarray with Ones after Replacement \(hard\) [LeetCode](https://leetcode.com/problems/max-consecutive-ones-iii/) 9. Problem Challenge 1 - Permutation in a String \(hard\) [Leetcode](https://leetcode.com/problems/permutation-in-string/) 10. Problem Challenge 2 - String Anagrams \(hard\) [Leetcode](https://leetcode.com/problems/find-all-anagrams-in-a-string/) 11. Problem Challenge 3 - Smallest Window containing Substring \(hard\) [Leetcode](https://leetcode.com/problems/minimum-window-substring/) 12. Problem Challenge 4 - Words Concatenation \(hard\) [Leetcode](https://leetcode.com/problems/substring-with-concatenation-of-all-words/) ### 2. Pattern: Two Pointers 1. Introduction 2. Pair with Target Sum \(easy\) [LeetCode](https://leetcode.com/problems/two-sum/) 3. Remove Duplicates \(easy\) [LeetCode](https://leetcode.com/problems/remove-duplicates-from-sorted-list/) [LeetCode](https://leetcode.com/problems/remove-duplicates-from-sorted-list-ii/) [LeetCode](https://leetcode.com/problems/remove-duplicates-from-sorted-array-ii/) [LeetCode](https://leetcode.com/problems/find-the-duplicate-number/) [LeetCode](https://leetcode.com/problems/duplicate-zeros/) 4. Squaring a Sorted Array \(easy\) [LeetCode](https://leetcode.com/problems/squares-of-a-sorted-array/) 5. Triplet Sum to Zero \(medium\) [LeetCode](https://leetcode.com/problems/3sum/) 6. Triplet Sum Close to Target \(medium\) [LeetCode](https://leetcode.com/problems/3sum-closest/) 7. Triplets with Smaller Sum \(medium\) [LintCode](https://www.lintcode.com/problem/3sum-smaller/description) 8. Subarrays with Product Less than a Target \(medium\) [LeetCode](https://leetcode.com/problems/subarray-product-less-than-k/) 9. Dutch National Flag Problem \(medium\) [CoderByte](https://coderbyte.com/algorithm/dutch-national-flag-sorting-problem) 10. Problem Challenge 1 - Quadruple Sum to Target \(medium\) [Leetcode](https://leetcode.com/problems/4sum/) 11. Problem Challenge 2 - Comparing Strings containing Backspaces \(medium\) [Leetcode](https://leetcode.com/problems/backspace-string-compare/) 12. Problem Challenge 3 - Minimum Window Sort \(medium\) [Leetcode](https://leetcode.com/problems/shortest-unsorted-continuous-subarray/) [Ideserve](https://www.ideserve.co.in/learn/minimum-length-subarray-sorting-which-results-in-sorted-array) ### 3. Pattern: Fast & Slow pointers 1. Introduction [emre.me](https://emre.me/coding-patterns/fast-slow-pointers/) 2. LinkedList Cycle \(easy\) [Leetcode](https://leetcode.com/problems/linked-list-cycle/) 3. Start of LinkedList Cycle \(medium\) [Leetcode](https://leetcode.com/problems/linked-list-cycle-ii/) 4. Happy Number \(medium\) [Leetcode](https://leetcode.com/problems/happy-number/) 5. Middle of the LinkedList \(easy\) [Leetcode](https://leetcode.com/problems/middle-of-the-linked-list/) 6. Problem Challenge 1 - Palindrome LinkedList \(medium\) [Leetcode](https://leetcode.com/problems/palindrome-linked-list/) 7. Problem Challenge 2 - Rearrange a LinkedList \(medium\) [Leetcode](https://leetcode.com/problems/reorder-list/) 8. Problem Challenge 3 - Cycle in a Circular Array \(hard\) [Leetcode](https://leetcode.com/problems/circular-array-loop/) ### 4. Pattern: Merge Intervals 1. Introduction [Educative.io](https://www.educative.io/courses/grokking-the-coding-interview/3YVYvogqXpA) 2. Merge Intervals \(medium\) [Educative.io](https://www.educative.io/courses/grokking-the-coding-interview/3jyVPKRA8yx) 3. Insert Interval \(medium\) [Educative.io](https://www.educative.io/courses/grokking-the-coding-interview/3jKlyNMJPEM) 4. Intervals Intersection \(medium\) [Educative.io](https://www.educative.io/courses/grokking-the-coding-interview/JExVVqRAN9D) 5. Conflicting Appointments \(medium\) [Geeksforgeeks](https://www.geeksforgeeks.org/check-if-any-two-intervals-overlap-among-a-given-set-of-intervals/) 6. Problem Challenge 1 - Minimum Meeting Rooms \(hard\) [Lintcode](https://www.lintcode.com/problem/meeting-rooms-ii/) 7. Problem Challenge 2 - Maximum CPU Load \(hard\) [Geeksforgeeks](https://www.geeksforgeeks.org/maximum-cpu-load-from-the-given-list-of-jobs/) 8. Problem Challenge 3 - Employee Free Time \(hard\) [CoderTrain](https://www.codertrain.co/employee-free-time) ### 5. Pattern: Cyclic Sort 1. Introduction [emre.me](https://emre.me/coding-patterns/cyclic-sort/) 2. Cyclic Sort \(easy\) [Geeksforgeeks](https://www.geeksforgeeks.org/sort-an-array-which-contain-1-to-n-values-in-on-using-cycle-sort/) 3. Find the Missing Number \(easy\) [Leetcode](https://leetcode.com/problems/missing-number/) 4. Find all Missing Numbers \(easy\) [Leetcode](https://leetcode.com/problems/find-all-numbers-disappeared-in-an-array/) 5. Find the Duplicate Number \(easy\) [Leetcode](https://leetcode.com/problems/find-the-duplicate-number/) 6. Find all Duplicate Numbers \(easy\) [Leetcode](https://leetcode.com/problems/find-all-duplicates-in-an-array/) 7. Problem Challenge 1 - Find the Corrupt Pair \(easy\) [TheCodingSimplified](https://thecodingsimplified.com/find-currupt-pair/) 8. Problem Challenge 2 - Find the Smallest Missing Positive Number \(medium\) [Leetcode](https://leetcode.com/problems/first-missing-positive/) 9. Problem Challenge 3 - Find the First K Missing Positive Numbers \(hard\) [TheCodingSimplified](https://thecodingsimplified.com/find-the-first-k-missing-positive-number/) ### 6. Pattern: In-place Reversal of a LinkedList 1. Introduction [emre.me](https://emre.me/coding-patterns/in-place-reversal-of-a-linked-list/) 2. Reverse a LinkedList \(easy\) [Leetcode](https://leetcode.com/problems/reverse-linked-list/) 3. Reverse a Sub-list \(medium\) [Leetcode](https://leetcode.com/problems/reverse-linked-list-ii/) 4. Reverse every K-element Sub-list \(medium\) [Leetcode](https://leetcode.com/problems/reverse-nodes-in-k-group/) 5. Problem Challenge 1 - Reverse alternating K-element Sub-list \(medium\) [Geeksforgeeks](https://www.geeksforgeeks.org/reverse-alternate-k-nodes-in-a-singly-linked-list/) 6. Problem Challenge 2 - Rotate a LinkedList \(medium\) [Leetcode](https://leetcode.com/problems/rotate-list/) ### 7. Pattern: Tree Breadth First Search 1. Introduction 2. Binary Tree Level Order Traversal \(easy\) 3. Reverse Level Order Traversal \(easy\) 4. Zigzag Traversal \(medium\) 5. Level Averages in a Binary Tree \(easy\) 6. Minimum Depth of a Binary Tree \(easy\) 7. Level Order Successor \(easy\) 8. Connect Level Order Siblings \(medium\) ### 8. Pattern: Tree Depth First Search 1. Introduction 2. Binary Tree Path Sum \(easy\) 3. All Paths for a Sum \(medium\) 4. Sum of Path Numbers \(medium\) 5. Path With Given Sequence \(medium\) 6. Count Paths for a Sum \(medium\) ### 9. Pattern: Two Heaps 1. Introduction 2. Find the Median of a Number Stream \(medium\) 3. Sliding Window Median \(hard\) 4. Maximize Capital \(hard\) ### 10. Pattern: Subsets 1. Introduction [Educative.io](https://www.educative.io/courses/grokking-the-coding-interview/R87WmWYrELz) 2. Subsets \(easy\) [Educative.io](https://www.educative.io/courses/grokking-the-coding-interview/gx2OqlvEnWG) 3. Subsets With Duplicates \(easy\) [Educative.io](https://www.educative.io/courses/grokking-the-coding-interview/7npk3V3JQNr) 4. Permutations \(medium\) [Educative.io](https://www.educative.io/courses/grokking-the-coding-interview/B8R83jyN3KY) 5. String Permutations by changing case \(medium\) 6. Balanced Parentheses \(hard\) 7. Unique Generalized Abbreviations \(hard\) ### 11. Pattern: Modified Binary Search 1. Introduction 2. Order-agnostic Binary Search \(easy\) 3. Ceiling of a Number \(medium\) 4. Next Letter \(medium\) 5. Number Range \(medium\) 6. Search in a Sorted Infinite Array \(medium\) 7. Minimum Difference Element \(medium\) 8. Bitonic Array Maximum \(easy\) ### 12. Pattern: Bitwise XOR 1. Introduction 2. Single Number \(easy\) 3. Two Single Numbers \(medium\) 4. Complement of Base 10 Number \(medium\) ### 13. Pattern: Top 'K' Elements 1. Introduction 2. Top 'K' Numbers \(easy\) 3. Kth Smallest Number \(easy\) 4. 'K' Closest Points to the Origin \(easy\) 5. Connect Ropes \(easy\) 6. Top 'K' Frequent Numbers \(medium\) 7. Frequency Sort \(medium\) 8. Kth Largest Number in a Stream \(medium\) 9. 'K' Closest Numbers \(medium\) 10. Maximum Distinct Elements \(medium\) 11. Sum of Elements \(medium\) 12. Rearrange String \(hard\) ### 14. Pattern: K-way merge 1. Introduction 2. Merge K Sorted Lists \(medium\) 3. Kth Smallest Number in M Sorted Lists \(Medium\) 4. Kth Smallest Number in a Sorted Matrix \(Hard\) [Educative.io](https://www.educative.io/courses/grokking-the-coding-interview/x1NJVYKNvqz) 5. Smallest Number Range \(Hard\) ### 15. Pattern : 0/1 Knapsack \(Dynamic Programming\) 1. Introduction 2. 0/1 Knapsack \(medium\) 3. Equal Subset Sum Partition \(medium\) 4. Subset Sum \(medium\) 5. Minimum Subset Sum Difference \(hard\) ### 16. Pattern: Topological Sort \(Graph\) 1. Introduction 2. Topological Sort \(medium\) 3. Tasks Scheduling \(medium\) 4. Tasks Scheduling Order \(medium\) 5. All Tasks Scheduling Orders \(hard\) 6. Alien Dictionary \(hard\) ### 17. Miscellaneous 1. Kth Smallest Number \(hard\) ### 18. Conclusions Where to Go from Here [Educative.io](https://www.educative.io/courses/grokking-the-coding-interview/gx3j14p5Y3Y)