![Data Structures & Algorithms](/_next/image?url=%2F_next%2Fstatic%2Fmedia%2Fdsa-banner.9114daf3.png&w=3840&q=75)
Data Structures and Algorithms
A visual guide to the most important patterns and approaches for the coding interview.
It's no secret that the coding interview is hard. You're asked to solve a challenging problem in limited time with the added pressure of someone judging your abilities. While there are a few ways to fail a coding interview, success typically follows a single pathway:
- You read the problem and quickly categorize it into an appropriate algorithm pattern or approach.
- You understand the key concepts of that pattern, and how they lead to an efficient or simple solution.
- You start with a template of that pattern, and fill in the details relevant to the problem.
- You do all this while discussing time and space complexities, trade-offs and other considerations with your interviewer.
This guide helps you develop this pathway for yourself by breaking down the coding interview into the most important patterns and approaches. The lessons teach you the key concepts of each pattern (step 2), when to use the pattern (step 1), and introduce the templates. The practice problems help you with steps 3 and 4.
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
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