Data Structures and Algorithms


Open Source Your Knowledge, Become a Contributor

Technology knowledge has to be shared and made accessible for free. Join the movement.

Create Content

LeetCode's Interview Crash Course

Data Structures and Algorithms


This is a data structures and algorithms (DSA) course with a strong focus on passing coding interviews for software engineering jobs.
Most DSA courses - including those offered in universities, tend to concentrate on theoretical concepts that don't matter in an interview.
Most of the time, these courses present zero or few examples of problems you would see in an interview.
This course takes a very pragmatic approach to teaching DSA.
The course is primarily taught through examples - it includes hundreds of carefully curated problems that show up in actual interviews.
These examples are delivered through a balanced mix of walkthroughs and exercises.
You will learn by doing.
Everything you need to pass coding interviews is here in one place.
We will not dwell on theoretical details or waste time on concepts that won't help you pass an interview.
The goal of this course is to get you a job, not pass an exam.
Regardless of your initial skill level, you should be comfortable with preparing for and passing coding interviews at tech companies after taking this course.
If your target is top-tier companies like FAANG, taking this course will set you up with all the fundamentals necessary to prepare for those interviews.

What does this course contain?

The course is split up into 13 chapters.
The bulk of the content is within chapters 2 - 11, each of which focuses on a data structure or algorithm:

  • Arrays and strings
  • Hashmaps and sets
  • Linked lists
  • Stacks and queues
  • Trees and graphs
  • Heaps
  • Greedy algorithms
  • Binary search
  • Backtracking
  • Dynamic programming

These are the most important and most common data structures and algorithms for coding interviews.

In each of these chapters, you can expect to find:

  • Explanation of the data structure/algorithm, what it's good at doing, how it can be used to solve problems, and details behind implementation & time/space complexity.
  • If it's a data structure, we will also talk about the interface and how to use it.
  • Common patterns and tricks related to the data structure or algorithm.
  • Several example walkthroughs of relevant problems to help illustrate the concepts supplemented with visual aids, concise explanations, and time/space complexity analysis.
  • Precisely curated practice problems to help you build muscle memory with what you've learned.
  • We also provide a list of bonus problems at the end of each chapter.
    These problems are optional but can be used to reinforce the ideas learned in each chapter.

The 12th chapter contains several useful tools that can be used moving forward.
There are code templates for all common patterns, cheatsheets regarding time and space complexities, and a flowchart that can be used as a general guideline when trying to figure out what data structure or algorithm should be used.
We will also break down the stages of a coding interview and what you should do at each stage.
To demonstrate this advice, there are example FAANG mock interview videos.

The final chapter is a bonus chapter where we will look into a few more techniques that aren't common/broad enough to warrant their own chapter.

All content is original and exclusive to this course.

Who is this course for?

This course is designed to help everyone increase their skill and confidence in coding interviews.
The explanations start small, so even if you have no experience with data structures and algorithms, you will be completely fine.

This course is perfect for you if you are someone who:

  • Wants to learn data structures and algorithms for the purpose of passing coding interviews
  • Is a beginner to algorithm problems and wants to build a good foundation
  • Is planning to start applying soon and wants to brush up
  • Is not a beginner but still wants to improve their skills in coding interviews

The only assumption is that you already know basic coding in a common language like Java, C++, Python, or JavaScript.

Feature breakdown
  • 93+ walkthroughs of example problems.
  • These problems are used to demonstrate common patterns, how to recognize them, and how to implement solutions.
    Explanations are beginner friendly and concise.
  • 67+ curated practice problems.
    These problems are precisely chosen and placed so that you can apply your learnings in each chapter.
    Solve these problems in LeetCode's integrated coding environment - the best way to learn is by doing.
  • 125+ visual aids.
    These range from animations to full videos walking through an algorithm.
    These visual aids are designed to help you quickly understand complicated concepts.
  • 12 quizzes.
    Each data structure or algorithm has a quiz at the end of the chapter to test your knowledge (the trees and graphs chapter has two quizzes, and the final chapter has a "final" quiz).
  • 137+ bonus problems.
    These high quality problems are handpicked by the author.
    While not mandatory, they can help you master the concepts taught in the course.
  • Lifetime access.
    Pay once and have access to the course and all benefits forever.
  • Continuous improvement.
    New walkthroughs, practice problems, and visual aids are continuously being added.
    As we receive feedback, we will also continuously add features and improve the overall quality and depth of the course.
  • An exclusive community.
    Access to a chat server where you can meet other course-takers and the course author.
    You can form study groups, organize mock interviews, and ask questions about the course, data structures and algorithms, or interviewing in general.
  • Integrated environment.
    Solve problems using LeetCode's coding environment which supports 19 different languages.
  • No setup required.
    Don't worry about IDEs or other programs.
    Everything is right here.

Course Content Breakdown

Introduction Introduction

  1. Testimonials
  2. Introduction to big O
  3. Introduction to recursion
  4. Notes before starting

Arrays and Strings Arrays and Strings

Arrays and Strings
  1. Arrays and strings
  2. Two pointers
  3. Reverse String
  4. Squares of a Sorted Array
  5. Sliding window
  6. Maximum Average Subarray I
  7. Max Consecutive Ones III
  8. Prefix sum
  9. Running Sum of 1d Array
  10. Minimum Value to Get Positive Step by Step Sum
  11. K Radius Subarray Averages
  12. More common patterns
  13. Arrays and strings quiz
  14. Bonus problems, arrays and strings

Hashing Hashing

  1. Hashing
  2. Checking for existence
  3. Check if the Sentence Is Pangram
  4. Missing Number
  5. Counting Elements
  6. Counting
  7. Find Players With Zero or One Losses
  8. Largest Unique Number
  9. Maximum Number of Balloons
  10. Contiguous Array
  11. More hashing examples
  12. Ransom Note
  13. Jewels and Stones
  14. Longest Substring Without Repeating Characters
  15. Hashing quiz
  16. Bonus problems, hashing

Linked Lists Linked Lists

Linked Lists
  1. Linked lists
  2. Fast and slow pointers
  3. Middle of the Linked List
  4. Remove Duplicates from Sorted List
  5. Reversing a linked list
  6. Reverse Linked List II
  7. Linked list quiz
  8. Bonus problems, linked lists

Stacks and Queues Stacks and Queues

Stacks and Queues
  1. Stacks
  2. String problems
  3. Simplify Path
  4. Make The String Great
  5. Queues
  6. Moving Average from Data Stream
  7. Monotonic
  8. Next Greater Element I
  9. Online Stock Span
  10. Stacks and queues quiz
  11. Bonus problems, stacks and queues

Trees and Graphs Trees and Graphs

Trees and Graphs
  1. Binary trees
  2. Binary trees - DFS
  3. Minimum Depth of Binary Tree
  4. Maximum Difference Between Node and Ancestor
  5. Diameter of Binary Tree
  6. Binary trees - BFS
  7. Deepest Leaves Sum
  8. Binary Tree Zigzag Level Order Traversal
  9. Binary search trees
  10. Insert into a Binary Search Tree
  11. Closest Binary Search Tree Value
  12. Trees quiz
  13. Graphs
  14. Graphs - DFS
  15. Find if Path Exists in Graph
  16. Number of Connected Components in an Undirected Graph
  17. Max Area of Island
  18. Reachable Nodes With Restrictions
  19. Graphs - BFS
  20. Nearest Exit from Entrance in Maze
  21. Snakes and Ladders
  22. Implicit graphs
  23. Minimum Genetic Mutation
  24. Jump Game III
  25. Detonate the Maximum Bombs
  26. Word Ladder
  27. Graphs quiz
  28. Bonus problems, trees and graphs

Heaps Heaps

  1. Heaps
  2. Heap examples
  3. Remove Stones to Minimize the Total
  4. Minimum Cost to Connect Sticks
  5. Top k
  6. Kth Largest Element in an Array
  7. K Closest Points to Origin
  8. Kth Largest Element in a Stream
  9. Heap quiz
  10. Bonus problems, heaps

Greedy Greedy

  1. Greedy algorithms
  2. Example greedy problems
  3. Maximum 69 Number
  4. Maximum Units on a Truck
  5. How Many Apples Can You Put into the Basket
  6. Reduce Array Size to The Half
  7. Greedy quiz
  8. Bonus problems, greedy

Binary Search Binary Search

Binary Search
  1. Binary Search
  2. On arrays
  3. Search Insert Position
  4. Longest Subsequence With Limited Sum
  5. On solution spaces
  6. Find the Smallest Divisor Given a Threshold
  7. Divide Chocolate
  8. Split Array Largest Sum
  9. Binary search quiz
  10. Bonus problems, binary search

Backtracking Backtracking

  1. Backtracking
  2. Generation
  3. All Paths From Source to Target
  4. Letter Combinations of a Phone Number
  5. More constrained backtracking
  6. Generate Parentheses
  7. Numbers With Same Consecutive Differences
  8. Combination Sum III
  9. Backtracking quiz
  10. Bonus problems, backtracking

Dynamic Programming Dynamic Programming

Dynamic Programming
  1. Dynamic programming
  2. Framework for DP
  3. 1D problems
  4. Climbing Stairs
  5. Min Cost Climbing Stairs
  6. Coin Change
  7. Multi-dimensional problems
  8. Best Time to Buy and Sell Stock with Transaction Fee
  9. Best Time to Buy and Sell Stock with Cooldown
  10. Matrix DP
  11. Unique Paths II
  12. Minimum Falling Path Sum
  13. Dynamic programming quiz
  14. Bonus problems, dynamic programming

Interviews and Tools Interviews and Tools

Interviews and Tools
  1. Code templates
  2. Stages of an interview
  3. Cheatsheets
  4. Mock interviews

Bonus Bonus

  1. Difference array
  2. Tries
  3. Implement Trie (Prefix Tree)
  4. Bit manipulation
  5. Hamming Distance
  6. Intervals
  7. Insert Interval
  8. Modular arithmetic
  9. Dijkstra's
  10. Cheapest Flights Within K Stops
  11. Final quiz
  12. Next steps
Open Source Your Knowledge: become a Contributor and help others learn. Create New Content