Grokking the Coding Interview: Patterns for Coding Questions
Fast track your coding interview prep by learning coding patterns. Act smartly, and follow the coding patterns.

Course Overview
Coding interviews are becoming increasingly challenging. A few years back, brushing up on key data structures and going through 50 to 75 coding interview questions was more than enough prep for an interview. Today, everyone has access to massive collections of coding problems, and these problems have become increasingly difficult to account for. The process has gotten more competitive. When our team sat together to brainstorm ideas to make the interview process easier for candidates, we quickly realized that one skill helped us the most when preparing for coding interviews: "the ability to map a new problem to an already known problem." To help candidates with this, we have compiled a list of 31 common and 11 advanced coding patterns to help solve coding questions. The idea is that once you are familiar with a pattern, you'll be able to solve dozens of problems with it. The techniques taught in this course have helped developers land jobs at top companies like Google, Meta, Amazon, Oracle, OpenAI, and Microsoft.
What you'll learn in Grokking Coding Interview: Patterns for Coding Questions
- How to recognise the pattern behind a coding question, so one technique unlocks a whole family of problems instead of one answer you happened to memorise.
- More than 300 hand-picked interview problems, each with a problem statement, an in-browser editor to attempt it yourself first, and a full worked solution.
- Time and space complexity reasoning for every solution, which is what interviewers ask about once the code already works.
- Tree and graph work done properly: breadth first and depth first search, level order traversal, matrix islands, topological sort, and union find.
- Advanced patterns most courses leave out: segment trees, binary indexed trees, meet in the middle, articulation points and bridges, and prefix sums.
- All 41 coding patterns, from Two Pointers and Sliding Window through Topological Sort and Union Find to Segment Trees and Binary Indexed Trees.
- Solutions in Python, Java, C++, JavaScript, Go, and C#, so you can prepare in the language you will actually interview in.
- The highest-yield array patterns first: Two Pointers, Fast and Slow Pointers, Sliding Window, and Merge Intervals, which between them account for a large share of real interview questions.
- Dynamic programming split into families you can actually recognise, including 0/1 Knapsack, Fibonacci numbers, and palindromic subsequences, rather than one intimidating topic.
- 34 Test Your Knowledge problems across easy, medium, and hard, where nothing tells you which pattern applies, which is the only honest rehearsal for the real thing.
Course Content
Pattern: Two Pointers
Introduction to Two Pointers Pattern
Pair with Target Sum (easy)
Find Non-Duplicate Number Instances (easy)
Squaring a Sorted Array (easy)
Triplet Sum to Zero (medium)
Triplet Sum Close to Target (medium)
Triplets with Smaller Sum (medium)
Dutch National Flag Problem (medium)
Problem Challenge 1: Quadruple Sum to Target (medium)
Problem Challenge 2: Comparing Strings containing Backspaces (medium)
Problem Challenge 3: Minimum Window Sort (medium)
Pattern: Fast & Slow Pointers
Introduction to Fast & Slow Pointers Pattern
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)
Pattern: Sliding Window
Introduction to Sliding Window Pattern
Maximum Sum Subarray of Size K (easy)
Smallest Subarray With a Greater Sum (easy)
Longest Substring with K Distinct Characters (medium)
Fruits into Baskets (medium)
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)
Problem Challenge 5: Counting Subarrays with Product Less than a Target (hard)
Problem Challenge 6: Subarrays with Product Less than a Target (hard)
Pattern: Merge Intervals
Pattern: Cyclic Sort
Introduction to Cyclic Sort Pattern
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)
Pattern: In-place Reversal of a Linked List
Pattern: Stacks
Introduction to Stack
Implementing Stack Data Structure
Using Built-in Stack in Different Programming Languages
Applications of Stack
Introduction to Stack Pattern
Problem 1: Balanced Parentheses (easy)
Problem 2: Reverse a String (easy)
Problem 3: Decimal to Binary Conversion (medium)
Problem 4: Next Greater Element (easy)
Problem 5: Sorting a Stack (easy)
Problem 6: Simplify Path (medium)
Pattern: Monotonic Stack
Pattern: Hash Maps
Introduction to Hash Tables
Hashing, Collisions, Overflow, and Resizing in Hashtables
Using Hashtable in Different Programming Languages
Introduction to Hash Map Pattern
Problem 1: First Non-repeating Character (easy)
Problem 2: Largest Unique Number (easy)
Problem 3: Maximum Number of Balloons (easy)
Problem 4: Longest Palindrome (easy)
Problem 5: Ransom Note (easy)
Pattern: Tree Level Order Traversal
Introduction to Tree Level Order Traversal Pattern
Binary Tree Level Order Traversal (easy)
Reverse Level Order Traversal (easy)
Zigzag Traversal (medium)
Level Averages in a Binary Tree (easy)
Find Largest Value in Each Tree Row (medium)
Maximum Level Sum of a Binary Tree (medium)
Even Odd Tree (medium)
Minimum Depth of a Binary Tree (easy)
Level Order Successor (easy)
Connect Level Order Siblings (medium)
Maximum Width of Binary Tree (medium)
N-ary Tree Level Order Traversal (hard)
Problem Challenge 1: Connect All Level Order Siblings (medium)
Problem Challenge 2: Right View of a Binary Tree (easy)
Pattern: Tree Depth First Search
Pattern: Graphs
Introduction to Graph
Types of Graph
Graph Representations
Graph Traversal - Depth First Search(DFS)
Graph Traversal - Breadth First Search (BFS)
Introduction to Graph Pattern
Find if Path Exists in Graph (easy)
Number of Provinces (medium)
Find Eventual Safe States (medium)
Minimum Number of Vertices to Reach All Nodes (medium)
Bus Routes (hard)
Pattern: Subsets
Introduction to Subsets Pattern
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)
Pattern: Modified Binary Search
Introduction to Modified Binary Search Pattern
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)
Pattern: Top 'K' Elements
Introduction to Top 'K' Elements Pattern
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)
Pattern: 0/1 Knapsack (Dynamic Programming)
Fibonacci Numbers (Dynamic Programming)
NewPalindromic Subsequence (Dynamic Programming)
NewPattern: Topological Sort (Graph)
Pattern: Ordered Set
NewPattern: Prefix Sum
NewIntroduction Prefix Sum Pattern
Find the Middle Index in Array (easy)
Left and Right Sum Differences (easy)
Maximum Size Subarray Sum Equals k (medium)
Binary Subarrays With Sum (medium)
Subarray Sums Divisible by K (medium)
Sum of Absolute Differences in a Sorted Array (medium)
Subarray Sum Equals K (medium)
Pattern: Multi-threaded
NewCounting Pattern (easy)
Introduction to Counting Pattern
Count Elements With Maximum Frequency (easy)
Maximum Population Year (easy)
Hidden Document
Hidden Document
Hidden Document
Hidden Document
Hidden Document
Hidden Document
Hidden Document
Hidden Document
Monotonic Queue Pattern (easy)
Introduction to Monotonic Queue Pattern
Longest Continuous Subarray With Absolute Diff Less Than or Equal to Limit (medium)
Minimum Number of Coins for Fruits (medium)
Hidden Document
Hidden Document
Hidden Document
Hidden Document
Hidden Document
Hidden Document
Simulation Pattern (easy)
Introduction to Simulation Pattern
Array Transformation (easy)
Water Bottles (easy)
Hidden Document
Hidden Document
Hidden Document
Hidden Document
Hidden Document
Hidden Document
Hidden Document
Hidden Document
Linear Sorting Algorithm Pattern (easy)
Introduction to Linear Sorting Algorithms
Counting Sort Algorithm
Radix Sort Algorithm
Bucket Sort Algorithm
Relative Sort Array (easy)
Height Checker (easy)
Hidden Document
Hidden Document
Hidden Document
Hidden Document
Hidden Document
Hidden Document
Hidden Document
Hidden Document
Meet in the Middle Pattern (medium)
NewIntroduction to Meet in the Middle
Subset Sum Equal to Target (medium)
Subsets having Sum between A and B (hard)
Hidden Document
Hidden Document
Hidden Document
Hidden Document
Hidden Document
Hidden Document
MO’s Algorithm Pattern (medium)
NewIntroduction to MO’s Algorithm Pattern
XOR Queries of a Subarray (medium)
Hidden Document
Hidden Document
Hidden Document
Hidden Document
Hidden Document
Hidden Document
Serialize and Deserialize Pattern (medium)
NewIntroduction to Serialize and Deserialize Pattern
Encode and Decode Strings (medium)
Hidden Document
Hidden Document
Hidden Document
Hidden Document
Hidden Document
Hidden Document
Serialize and Deserialize N-ary Tree (hard)
Hidden Document
Clone Pattern (medium)
NewIntroduction to Clone Pattern
Copy List with Random Pointer (medium)
Hidden Document
Hidden Document
Hidden Document
Hidden Document
Clone N-ary Tree (hard)
Hidden Document
Articulation Points and Bridges Pattern (hard)
NewIntroduction to Articulation Points and Bridges Pattern
Minimum Number of Days to Disconnect Island (hard)
Hidden Document
Hidden Document
Hidden Document
Hidden Document
Hidden Document
Hidden Document
Segment Tree Pattern (hard)
NewIntroduction to Segment Tree Pattern
Operations on Segment Tree
Range Minimum Query (easy)
Hidden Document
Hidden Document
Hidden Document
Hidden Document
Hidden Document
Hidden Document
Binary Indexed Tree Pattern (hard)
NewIntroduction to Binary Indexed Tree Pattern
Implementation of Binary Indexed Tree
Number of Longest Increasing Subsequence (medium)
Maximum Profitable Triplets With Increasing Prices I (medium)
Hidden Document
Hidden Document
Hidden Document
Hidden Document
Hidden Document
Hidden Document
Hidden Document
Hidden Document
Miscellaneous
Revision
Test Your Knowledge (Medium)
Daily Temperatures (medium)
Group Anagrams (medium)
Decode String (medium)
Valid Sudoku (medium)
Product of Array Except Self (medium)
Maximum Product Subarray (medium)
Container With Most Water (medium)
Palindromic Substrings (medium)
Remove Nth Node From End of List (medium)
Find Minimum in Rotated Sorted Array (medium)
Pacific Atlantic Water Flow (medium)
Validate Binary Search Tree (medium)
Construct Binary Tree from Preorder and Inorder Traversal (medium)
Clone Graph (medium)
House Robber II (medium)
Decode Ways (medium)
Unique Paths (medium)
Word Break (medium)
Lowest Common Ancestor of a Binary Search Tree (medium)
Longest Consecutive Sequence (medium)
Meeting Rooms II (medium)
Encode and Decode Strings (medium)
Number of Connected Components in an Undirected Graph (medium)
Graph Valid Tree (medium)
Implement Trie (Prefix Tree) (medium)
Design Add and Search Words Data Structure (medium)
Test Your Knowledge (Hard)
Conclusions
What people say about our courses




About the Author

Arslan Ahmad
Industry Expertise & Leadership
Arslan Ahmad is the lead author of Grokking the Coding Interview: Patterns for Coding Questions. As the founder of Design Gurus and a former FAANG hiring manager, he has worked at industry giants like Facebook (now Meta) and Microsoft.
He has conducted hundreds of system design interviews, giving him unique insight into what top tech companies look for in candidates.
The course also incorporates expertise from senior engineers at Google, Meta, Amazon, Microsoft, and Uber, ensuring you learn system design best practices from professionals who have built and scaled real-world systems.
500+
Interviews Conducted
10k+
Students Taught
FAQs
What is Grokking the Coding Interview and who is it for?
Grokking the Coding Interview: Patterns for Coding Questions is an online course that teaches you how to solve coding interview problems using reusable patterns, instead of memorizing hundreds of individual questions. It's the original coding patterns course and it's rated 4.6 out of 5 by more than 62,000 learners. Whether you're a new grad facing your first coding round or a senior engineer brushing up before interviews, it gives you a clear, structured way to prepare so you can walk in confident.
What are coding patterns, and why does Grokking teach them?
Coding patterns are reusable problem-solving templates like Two Pointers, Sliding Window, Merge Intervals, and Topological Sort, and each one unlocks a whole family of interview questions. Instead of grinding through hundreds of unrelated problems, Grokking the Coding Interview organizes more than 300 problems around these patterns, so you learn the underlying approach once and start recognizing it everywhere. Once you can see the pattern behind a question, even unfamiliar problems feel approachable.
Who created Grokking the Coding Interview, and what are their credentials?
Grokking the Coding Interview was created by the team at Design Gurus, led by Arslan Ahmad, an ex-FAANG engineer and former hiring manager at Meta and Microsoft. Having sat on both sides of the interview table, he built the course around what interviewers actually look for. The pattern-based approach it introduced has since been used by hundreds of thousands of engineers preparing for coding interviews.
Is Grokking the Coding Interview suitable for beginners?
Yes, if you already know the basics. Every pattern is taught from the ground up, so you need no prior interview practice at all. The course starts with easy problems and builds toward harder ones gradually. What you do need first is a working knowledge of common data structures. That means arrays, linked lists, hash maps, stacks, queues, heaps, and graphs, plus Big-O notation and recursion. If any of those are new to you, start with Grokking Data Structures & Algorithms for Coding Interviews and come back.
How is Grokking the Coding Interview different from LeetCode?
LeetCode is a huge bank of problems you practice on your own, while Grokking the Coding Interview is a structured course that teaches you the patterns behind those problems. Rather than solving questions at random and hoping something sticks, you learn a focused set of coding patterns backed by more than 300 hand-picked problems. The result is that you start seeing the strategy behind a question instead of memorizing one-off solutions.
How many problems does Grokking the Coding Interview include, and how is it structured?
Grokking the Coding Interview includes more than 300 hand-picked coding problems, organized into pattern-based chapters that move from easy to hard. Each chapter centers on a single pattern and works through the problems that reinforce it, so you build real depth in one pattern before moving on to the next. By the end you've covered a wide range of patterns with plenty of practice in each.
Does Grokking the Coding Interview provide a certificate of completion?
Yes, Design Gurus gives you a certificate of completion once you finish all the modules, and you can add it to your LinkedIn profile or share it with employers.
Is Grokking the Coding Interview free?
You can start Grokking the Coding Interview for free on DesignGurus.io. The free tier lets you explore the introductory lessons and get a feel for how the course is structured before you commit. For full access to all the problems and their solutions, you can either buy lifetime access to this course or take an annual subscription that unlocks every Design Gurus course, and discounted regional pricing is available.
Which programming languages does Grokking the Coding Interview support?
Grokking the Coding Interview gives you solutions in Python, Java, C++, JavaScript, Go, and C#, so you can learn and practice in whatever language you'll actually use in your interview.
Is Grokking the Coding Interview the same on Educative and Design Gurus?
No, they're two different courses today. The official, continuously updated Grokking the Coding Interview lives only on DesignGurus.io, built and maintained by the original creators. An earlier text-only version was once hosted on the third-party platform Educative, but that edition is no longer maintained by the original authors, so for the authentic, up-to-date course, DesignGurus.io is the only place to find it.
Will Grokking the Coding Interview help me prepare for FAANG coding interviews?
Grokking the Coding Interview is built to prepare you for the coding round used at FAANG and other top tech companies, because it teaches the patterns behind the questions those interviews rely on. You'll practice exactly what interviewers evaluate: spotting the right pattern, writing a correct solution, and reasoning about time and space complexity. That mix is what helps you stay calm and structured when a tough problem shows up.
