This repository contains Python solutions to the NeetCode 150 problems - a curated list of LeetCode questions designed to help you ace the coding interviews! ๐ป
The solutions are organized by problem categories to make it easier to focus on specific areas. Each solution includes a link to the LeetCode problem and, when available, a link to a video explanation.
These solutions were adapted from the freeCodeCamp article on NeetCode 150 and refactored into this organized format. The original Java solutions were converted to Python.
# | Problem | Solution | Video |
---|---|---|---|
1 | Two Sum | Solution | Video |
49 | Group Anagrams | Solution | Video |
347 | Top K Frequent Elements | Solution | Video |
242 | Valid Anagram | Solution | Video |
953 | Verifying an Alien Dictionary | Solution | Video |
# | Problem | Solution | Video |
---|---|---|---|
15 | 3Sum | Solution | Video |
125 | Valid Palindrome | Solution | Video |
# | Problem | Solution | Video |
---|---|---|---|
3 | Longest Substring Without Repeating Characters | Solution | Video |
121 | Best Time to Buy and Sell Stock | Solution | Video |
# | Problem | Solution | Video |
---|---|---|---|
20 | Valid Parentheses | Solution | Video |
32 | Longest Valid Parentheses | Solution | Video |
150 | Evaluate Reverse Polish Notation | Solution | Video |
853 | Car Fleet | Solution | Video |
1249 | Minimum Remove to Make Valid Parentheses | Solution | Video |
# | Problem | Solution | Video |
---|---|---|---|
33 | Search in Rotated Sorted Array | Solution | Video |
153 | Find Minimum in Rotated Sorted Array | Solution | Video |
875 | Koko Eating Bananas | Solution | Video |
74 | Search a 2D Matrix | Solution | Video |
704 | Binary Search | Solution | Video |
34 | Find First and Last Position of Element in Sorted Array | Solution | Video |
# | Problem | Solution | Video |
---|---|---|---|
21 | Merge Two Sorted Lists | Solution | Video |
25 | Reverse Nodes in k-Group | Solution | Video |
138 | Copy List with Random Pointer | Solution | Video |
143 | Reorder List | Solution | Video |
148 | Sort List | Solution | Video |
141 | Linked List Cycle | Solution | Video |
24 | Swap Nodes in Pairs | Solution | Video |
# | Problem | Solution | Video |
---|---|---|---|
621 | Task Scheduler | Solution | Video |
973 | K Closest Points to Origin | Solution | Video |
1046 | Last Stone Weight | Solution | Video |
1851 | Minimum Interval to Include Each Query | Solution | Video |
# | Problem | Solution | Video |
---|---|---|---|
127 | Word Ladder | Solution | Video |
130 | Surrounded Regions | Solution | Video |
133 | Clone Graph | Solution | Video |
210 | Course Schedule II | Solution | Video |
286 | Walls and Gates | Solution | Video |
332 | Reconstruct Itinerary | Solution | Video |
547 | Number of Provinces | Solution | Video |
759 | Employee Free Time | Solution | Video |
778 | Swim in Rising Water | Solution | Video |
994 | Rotting Oranges | Solution | Video |
269 | Alien Dictionary | Solution | Video |
695 | Max Area of Island | Solution | Video |
329 | Longest Increasing Path in a Matrix | Solution | Video |
# | Problem | Solution | Video |
---|---|---|---|
5 | Longest Palindromic Substring | Solution | Video |
70 | Climbing Stairs | Solution | Video |
115 | Distinct Subsequences | Solution | Video |
152 | Maximum Product Subarray | Solution | Video |
312 | Burst Balloons | Solution | Video |
416 | Partition Equal Subset Sum | Solution | Video |
494 | Target Sum | Solution | Video |
818 | Race Car | Solution | Video |
1143 | Longest Common Subsequence | Solution | Video |
62 | Unique Paths | Solution | Video |
45 | Jump Game II | Solution | Video |
# | Problem | Solution | Video |
---|---|---|---|
134 | Gas Station | Solution | Video |
763 | Partition Labels | Solution | Video |
# | Problem | Solution | Video |
---|---|---|---|
22 | Generate Parentheses | Solution | Video |
46 | Permutations | Solution | Video |
51 | N-Queens | Solution | Video |
79 | Word Search | Solution | Video |
90 | Subsets II | Solution | Video |
131 | Palindrome Partitioning | Solution | Video |
# | Problem | Solution | Video |
---|---|---|---|
31 | Next Permutation | Solution | Video |
50 | Pow(x, n) | Solution | Video |
66 | Plus One | Solution | Video |
68 | Text Justification | Solution | Video |
73 | Set Matrix Zeroes | Solution | Video |
88 | Merge Sorted Array | Solution | Video |
179 | Largest Number | Solution | Video |
287 | Find the Duplicate Number | Solution | Video |
54 | Spiral Matrix | Solution | Video |
48 | Rotate Image | Solution | Video |
36 | Valid Sudoku | Solution | Video |
289 | Game of Life | Solution | Video |
7 | Reverse Integer | Solution | Video |
9 | Palindrome Number | Solution | Video |
# | Problem | Solution | Video |
---|---|---|---|
56 | Merge Intervals | Solution | Video |
57 | Insert Interval | Solution | Video |
435 | Non-overlapping Intervals | Solution | Video |
# | Problem | Solution | Video |
---|---|---|---|
146 | LRU Cache | Solution | Video |
380 | Insert Delete GetRandom O(1) | Solution | Video |
981 | Time Based Key-Value Store | Solution | Video |
2013 | Detect Squares | Solution | Video |
- Navigate to the category you're interested in
- Pick a problem and review the solution
- If available, watch the video explanation for deeper understanding
- Try implementing the solution yourself before checking the code
This repository is available under the MIT License.