👨‍💻
Coding Interview Patterns
  • Coding Interview Patterns
  • 1. Pattern: Sliding Window
    • 1.0 Introduction
    • 1.1 Maximum Sum Subarray of Size K (easy)
    • 1.2 Smallest Subarray with a given sum (easy)
    • 1.3 Longest Substring with K Distinct Characters (medium)
    • 1.4 Fruits into Baskets (medium)
    • 1.5 No-repeat Substring (hard)
    • 1.6 Longest Substring with Same Letters after Replacement (hard)
    • 1.7 Longest Subarray with Ones after Replacement (hard)
    • 1.8 - Permutation in a String (hard)
    • 1.9 String Anagrams (hard)
    • 1.10 Smallest Window containing Substring (hard)
    • 1.11 Words Concatenation (hard)
  • 2. Pattern: Two Pointers
    • 2.0 Introduction
    • 2.1 Pair with Target Sum (easy)
    • 2.2 Remove Duplicates (easy)
    • 2.3 Squaring a Sorted Array (easy)
    • 2.4 Triplet Sum to Zero (medium)
    • 2.5 Triplet Sum Close to Target (medium)
    • 2.6 Triplets with Smaller Sum (medium)
    • 2.7 Subarrays with Product Less than a Target (medium)
    • 2.8 Dutch National Flag Problem (medium)
    • 2.9 Comparing Strings containing Backspaces (medium)
    • 2.10 Minimum Window Sort (medium)
  • 7. Pattern: Tree Breadth First Search
    • 7.0 Introduction
    • 7.1 Binary Tree Level Order Traversal (easy)
    • 7.2 Reverse Level Order Traversal (easy)
    • 7.3 Zigzag Traversal (medium)
    • 7.4 Level Averages in a Binary Tree (easy)
    • 7.5 Minimum Depth of a Binary Tree (easy)
    • 7.6 Maximum Depth of Binary Tree (easy)
    • 7.7 Level Order Successor (easy)
    • 7.8 Connect Level Order Siblings (medium)
    • 7.9 Problem Challenge 1 - Connect All Level Order Siblings (medium)
    • 7.10 Problem Challenge 2 - Right View of a Binary Tree (easy)
  • 11. Pattern: Modified Binary Search
    • 11.1 Introduction
    • 11.2 Order-agnostic Binary Search (easy)
    • 11.3
  • 16. Pattern: Topological Sort (Graph)
    • 16.1 Introduction
    • 16.2 Topological Sort (medium)
    • 16.3 Tasks Scheduling (medium)
    • 16.4 Tasks Scheduling Order (medium)
  • Contributor Covenant Code of Conduct
  • Page 1
Powered by GitBook
On this page
  • Coding Interview Patterns
  • 1. Pattern: Two Pointers
  • 2. Pattern: Fast & Slow pointers
  • 3. Pattern: Sliding Window
  • 4. Pattern: Merge Intervals
  • 5. Pattern: Cyclic Sort
  • 6. Pattern: In-place Reversal of a LinkedList
  • 7. Pattern: Stack
  • 8. Pattern: Monotonic Stack
  • 9. Pattern: Hash Maps
  • 10. Pattern: Tree Breadth First Search
  • 11. Pattern: Tree Depth First Search
  • 12. Pattern: Graphs
  • 13. Pattern: Island (Matrix traversal)
  • 14. Pattern: Two Heaps
  • 15. Pattern: Subsets
  • 16. Pattern: Modified Binary Search
  • 17. Pattern: Bitwise XOR
  • 18. Pattern: Top 'K' Elements
  • 19. Pattern: K-way merge
  • 20. Pattern: Greedy Algorithms
  • 21. Pattern : 0/1 Knapsack (Dynamic Programming)
  • 22. Pattern: Backtracking
  • 23. Pattern: Trie
  • 24. Pattern: Topological Sort (Graph)
  • 25. Pattern: Union Find
  • 26. Ordered Set
  • 27. Pattern: Multi-thread
  • 28. Miscellaneous
  • Revision
  • Test Your Knowledge

Was this helpful?

Coding Interview Patterns

Next1. Pattern: Sliding Window

Last updated 2 months ago

Was this helpful?

Coding Interview Patterns

1. Pattern: Two Pointers

  1. Introduction

  2. Pair with Target Sum (easy)

  3. Remove Duplicates (easy)

  4. Squaring a Sorted Array (easy)

  5. Triplet Sum to Zero (medium)

  6. Triplet Sum Close to Target (medium)

  7. Triplets with Smaller Sum (medium)

  8. Subarrays with Product Less than a Target (medium)

  9. Dutch National Flag Problem (medium)

  10. Problem Challenge 1: Quadruple Sum to Target (medium)

  11. Problem Challenge 2: Comparing Strings containing Backspaces (medium)

  12. Problem Challenge 3: Minimum Window Sort (medium)

2. Pattern: Fast & Slow pointers

3. Pattern: Sliding Window

  1. Introduction

  2. Maximum Sum Subarray of Size K (easy)

4. Pattern: Merge Intervals

5. Pattern: Cyclic Sort

6. Pattern: In-place Reversal of a LinkedList

7. Pattern: Stack

  1. Introduction to Stack (Operations, Implementation, Applications)

  2. Reverse a String

  3. Decimal to Binary Conversion

  4. Sorting a Stack

8. Pattern: Monotonic Stack

  1. Introduction to Monotonic Stack

9. Pattern: Hash Maps

  1. Introduction (Hashing, Hash Tables, Issues)

10. Pattern: Tree Breadth First Search

  1. Introduction

11. Pattern: Tree Depth First Search

  1. Introduction

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)

13. Pattern: Island (Matrix traversal)

  1. Introduction to Island Pattern

  2. Biggest Island (easy)

  3. Problem Challenge 1 (easy)

  4. Problem Challenge 2 (medium)

  5. Problem Challenge 3 (medium)

14. Pattern: Two Heaps

  1. Introduction

15. Pattern: Subsets

  1. String Permutations by changing case (medium)

  2. Balanced Parentheses (hard)

  1. Minimum Difference Element (medium): Find the floor & ceil take the difference, minimum would be the ans

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. Kth Smallest Number (easy)

  2. Connect Ropes (easy)

  3. Top 'K' Frequent Numbers (medium)

  4. Frequency Sort (medium)

  5. 'K' Closest Numbers (medium)

  6. Maximum Distinct Elements (medium)

  7. Sum of Elements (medium)

  8. Rearrange String (hard)

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

  10. Problem Challenge 2: Scheduling Tasks (hard)

  11. Problem Challenge 3: Frequency Stack (hard)

19. Pattern: K-way merge

  1. Introduction

  2. Problem Challenge 1: K Pairs with Largest Sums (hard)

20. Pattern: Greedy Algorithms

  1. Introduction to Greedy Algorithm

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

  1. Introduction

  2. Problem Challenge 1: Count of Subset Sum (hard)

  3. Problem Challenge 2: Target Sum (hard)

22. Pattern: Backtracking

  1. Introduction to Backtracking Pattern

23. Pattern: Trie

  1. Introduction to Trie

24. Pattern: Topological Sort (Graph)

  1. Introduction

25. Pattern: Union Find

  1. Introduction to Union Find Pattern

26. Ordered Set

  1. Introduction to Ordered Set Pattern

  2. 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

Test Your Knowledge

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

Introduction

LinkedList Cycle (easy)

Start of LinkedList Cycle (medium)

Happy Number (medium)

Middle of the LinkedList (easy)

Problem Challenge 1: Palindrome LinkedList (medium)

Problem Challenge 2: Rearrange a LinkedList (medium)

Problem Challenge 3: Cycle in a Circular Array (hard)

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)

Introduction

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)

Introduction

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)

Introduction

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)

Balanced Parentheses

Next Greater Element

Simplify Path

Next Greater Element (easy)

Daily Temperatures (easy)

Remove Nodes From Linked List (easy)

Remove All Adjacent Duplicates In String (easy)

Remove All Adjacent Duplicates in String II (medium)

Remove K Digits (hard)

First Non-repeating Character (easy)

Largest Unique Number (easy)

Maximum Number of Balloons (easy)

Longest Palindrome(easy)

Ransom Note (easy)

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)

Maximum 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)

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)

Find if Path Exists in Graph(easy)

Number of Provinces (medium)

Minimum Number of Vertices to Reach All Nodes(medium)

Number of Islands (easy)

Flood Fill (easy)

Number of Closed Islands (easy)

Find the Median of a Number Stream (medium)

Sliding Window Median (hard)

Maximize Capital (hard)

*Maximum Sum Combinations (medium)

Introduction

Subsets (easy)

Subsets With Duplicates (easy)

Permutations (medium)

Unique Generalized Abbreviations (hard)

Introduction

Order-agnostic Binary Search (easy)

Ceiling of a Number (medium)

Next Letter (medium)

Number Range (medium)

Search in a Sorted Infinite Array (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)

*Search a 2D Matrix (medium)

*Minimum Number of Days to Make m Bouquets (medium)

*Koko Eating Bananas (medium)

*Capacity To Ship Packages Within D Days (medium)

*Median of Two Sorted Arrays (hard)

Top 'K' Numbers (easy)

'K' Closest Points to the Origin (easy)

Kth Largest Number in a Stream (medium)

*

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)

Valid Palindrome II (easy)

Maximum Length of Pair Chain (medium)

Minimum Add to Make Parentheses Valid (medium)

Remove Duplicate Letters (medium)

Largest Palindromic Number (Medium)

Removing Minimum and Maximum From Array (medium)

0/1 Knapsack (medium)

Equal Subset Sum Partition (medium)

Subset Sum (medium)

Minimum Subset Sum Difference (hard)

Combination Sum (medium)

Word Search (medium)

Sudoku Solver (hard)

Factor Combinations (medium)

Split a String Into the Max Number of Unique Substrings (medium)

Implement Trie (Prefix Tree) (medium)

Index Pairs of a String (easy)

Design Add and Search Words Data Structure (medium)

Extra Characters in a String (medium)

Search Suggestions System (medium)

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)

Redundant Connection (medium)

Number of Provinces (medium)

Is Graph Bipartite? (medium)

Path With Minimum Effort (medium)

Merge Similar Items (easy)

132 Pattern (medium)

My Calendar I (medium)

LeetCode
LeetCode
LeetCode
LeetCode
LeetCode
LeetCode
LeetCode
LeetCode
LeetCode
LintCode
LeetCode
CoderByte
Leetcode
Leetcode
Leetcode
Ideserve
emre.me
Leetcode
Leetcode
Leetcode
Leetcode
Leetcode
Leetcode
Leetcode
Educative.io
Educative.io
LeetCode
LeetCode
LeetCode
LeetCode
Leetcode
Leetcode
Leetcode
Leetcode
Educative.io
Educative.io
Educative.io
Educative.io
Geeksforgeeks
Lintcode
Geeksforgeeks
CoderTrain
emre.me
Geeksforgeeks
Leetcode
Leetcode
Leetcode
Leetcode
TheCodingSimplified
Leetcode
TheCodingSimplified
emre.me
Leetcode
Leetcode
Leetcode
Geeksforgeeks
Leetcode
Leetcode
Leetcode - I
Leetcode -II
Leetcode - III (Hard)
Leetcode
Leetcode - I
Leetcode -II
Leetcode - III (Hard)
Leetcode
Leetcode
Leetcode
Leetcode
Leetcode
Leetcode
Leetcode+
Leetcode
Leetcode
Leetcode
Leetcode
Leetcode
Leetcode
Leetcode
Leetcode
Leetcode
Geeksforgeeks
Leetcode
Educative
Leetcode
Leetcode
Leetcode
Leetcode
Geeksforgeeks
Leetcode
Leetcode
Leetcode
Leetcode
Leetcode
Leetcode
Leetcode
Leetcode
Leetcode
Leetcode
Leetcode
Leetcode
InterviewBit
Educative.io
Educative.io
Educative.io
Educative.io
Leetcode
16. Pattern: Modified Binary Search
Complete Pattern Theory and Solutions
Geeksforgeeks
Geeksforgeeks-Ceil
Geeksforgeeks-Floor
Leetcode
Leetcode
Leetcode
Geeksforgeeks
Leetcode
Leetcode
Geeksforgeeks
Leetcode
Leetcode
Leetcode
Leetcode
Leetcode
Introduction
Solution
Leetcode
Leetcode
Heap Implementation
Leetcode
Geeksforgeeks
Educative.io
Leetcode
Leetcode
Leetcode
Leetcode
Leetcode
Leetcode
Leetcode
Geeksforgeeks
Leetcode
Geeksforgeeks
Geeksforgeeks
Leetcode - I
Leetcode - II
Leetcode - III
Leetcode - IV
Leetcode - I
Leetcode - II (Hard)
Leetcode
Leetcode+
Leetcode
Leetcode
Leetcode+
Leetcode
Leetcode
Leetcode
Youtube
Leetcode-Similar
Leetcode-Similar
Leetcode-Similar
Leetcode
Leetcode
Leetcode
Leetcode - I
Leetcode - II (Hard)
Leetcode
Leetcode
Leetcode
Leetcode
Leetcode
Leetcode
Leetcode - II
Leetcode - III (Hard)
Coding Patterns: A Cheat Sheet
Easy Problems
Medium Problems
Hard Problems