Data Structures and Algorithms
A visual guide to the most important patterns and approaches for the coding interview.
This guide uses interactive visualizations to teach you the most important algorithm patterns for the coding interview.
Here's an example showing how a backtracking algorithm searches for the word HELLO:
Who is this for?
This is intended for those looking for a structured way to prepare for the coding interview using Python. It assumes you understand how and why to use fundamental data structures such as arrays, dictionaries, and sets.
How do I use this?
Unless they are labeled with a Pre-Requisite, the patterns can be completed in any order. If you’re short on time, start with Depth-First Search and Breadth-First Search, as they are the algorithms that most frequently show up during the coding interview.
Eliminating Pairs
Overview
Container With Most Water
3-Sum
Triangle Numbers
Pointers as Regions
Move Zeroes
Sort Colors
Trapping Rain Water
Variable-Length
Overview
Longest Substring Without Repeating Characters
Longest Repeating Character Replacement
Fixed-Length
Overview
Maximum Sum of Subarrays of Size K
Max Points You Can Obtain From Cards
Max Sum of Distinct Subarrays Length k
Overview
Can Attend Meetings
Insert Interval
Non-Overlapping Intervals
Merge Intervals
Employee Free Time
Overview
Valid Parentheses
Decode String
Longest Valid Parentheses
Monotonic Stack
Overview
Daily Temperatures
Largest Rectangle in Histogram
Overview
Linked List Cycle
Palindrome Linked List
Remove Nth Node From End of List
Reorder List
Swap Nodes in Pairs
Overview
Kth Largest Element in an Array
K Closest Points to Origin
Find K Closest Elements
Merge K Sorted Lists
Introduction
Binary Trees
Fundamentals
Return Values
Maximum Depth of a Binary Tree
Path Sum
Helper Functions and Global Variables
Validate Binary Search Tree
Calculate Tilt
Diameter of a Binary Tree
Path Sum II
Longest Univalue Path
Graphs
Overview
Adjacency List
Copy Graph
Graph Valid Tree
Matrices
Flood Fill
Types of DFS
Number of Islands
Surrounded Regions
Pacific Atlantic Water Flow
Introduction
Binary Trees
Overview
Level Order Sum
Rightmost Node
Zigzag Level Order
Maximum Width of Binary Tree
Graphs
Overview
Minimum Knight Moves
Rotting Oranges
01-Matrix
Bus Routes
Overview
Word Search
Solution Space Trees
Subsets
Generate Parentheses
Combination Sum