This repository contains solutions to the NeetCode 150 problems, a curated list of LeetCode problems that cover essential data structures and algorithms concepts.
🔗 Practice Link: NeetCode.io
| Problem | LeetCode Link | Solution |
|---|---|---|
| Two Sum | Problem 1 | Solution |
| Contains Duplicate | Problem 217 | Solution |
| Valid Anagram | Problem 242 | Solution |
| Group Anagrams | Problem 49 | Solution |
| Top K Frequent Elements | Problem 347 | Solution |
| Product of Array Except Self | Problem 238 | Solution |
| Valid Sudoku | Problem 36 | Solution |
| Longest Consecutive Sequence | Problem 128 | Solution |
| Problem | LeetCode Link | Solution |
|---|---|---|
| Valid Palindrome | Problem 125 | Solution |
| Two Sum II - Input Array Is Sorted | Problem 167 | Solution |
| 3Sum | Problem 15 | Solution |
| Container With Most Water | Problem 11 | Solution |
| Trapping Rain Water | Problem 42 | Solution |
| Valid Palindrome II | Problem 680 | Solution |
| Reverse Words in a String | Problem 151 | Solution |
| Median of Two Sorted Arrays | Problem 4 | Solution |
| Find Beautiful Indices in the Given Array II | Problem 3008 | Solution |
| Problem | LeetCode Link | Solution |
|---|---|---|
| Best Time to Buy and Sell Stock | Problem 121 | Solution |
| Longest Substring Without Repeating Characters | Problem 3 | Solution |
| Longest Repeating Character Replacement | Problem 424 | Solution |
| Permutation in String | Problem 567 | Solution |
| Minimum Window Substring | Problem 76 | Solution |
| Sliding Window Maximum | Problem 239 | Solution |
| Problem | LeetCode Link | Solution |
|---|---|---|
| Valid Parentheses | Problem 20 | Solution |
| Min Stack | Problem 155 | Solution |
| Evaluate Reverse Polish Notation | Problem 150 | Solution |
| Generate Parentheses | Problem 22 | ❌ |
| Daily Temperatures | Problem 739 | Solution |
| Car Fleet | Problem 853 | Solution |
| Largest Rectangle in Histogram | Problem 84 | Solution |
| Trapping Rain Water | Problem 42 | Solution |
| Problem | LeetCode Link | Solution |
|---|---|---|
| Binary Search | Problem 704 | Solution |
| Search a 2D Matrix | Problem 74 | Solution |
| Koko Eating Bananas | Problem 875 | Solution |
| Find Minimum in Rotated Sorted Array | Problem 153 | Solution |
| Time Based Key-Value Store | Problem 981 | Solution |
| Problem | LeetCode Link | Solution |
|---|---|---|
| Reverse Linked List | Problem 206 | Solution |
| Merge Two Sorted Lists | Problem 21 | Solution |
| Reorder List | Problem 143 | Solution |
| Remove Nth Node From End of List | Problem 19 | Solution |
| Copy List with Random Pointer | Problem 138 | ❌ |
| Add Two Numbers | Problem 2 | Solution |
| Linked List Cycle | Problem 141 | Solution |
| Find the Duplicate Number | Problem 287 | Solution |
| LRU Cache | Problem 146 | Solution |
| Merge k Sorted Lists | Problem 23 | Solution |
| Problem | LeetCode Link | Solution |
|---|---|---|
| Invert Binary Tree | Problem 226 | Solution |
| Maximum Depth of Binary Tree | Problem 104 | Solution |
| Diameter of Binary Tree | Problem 543 | Solution |
| Balanced Binary Tree | Problem 110 | Solution |
| Same Tree | Problem 100 | Solution |
| Subtree of Another Tree | Problem 572 | Solution |
| Lowest Common Ancestor of a Binary Search Tree | Problem 235 | Solution |
| Binary Tree Level Order Traversal | Problem 102 | Solution |
| Binary Tree Right Side View | Problem 199 | Solution |
| Count Good Nodes in Binary Tree | Problem 1448 | Solution |
| Validate Binary Search Tree | Problem 98 | Solution |
| Kth Smallest Element in a BST | Problem 230 | Solution |
| Construct Binary Tree from Preorder and Inorder Traversal | Problem 105 | ❌ |
| Binary Tree Maximum Path Sum | Problem 124 | Solution |
| Serialize and Deserialize Binary Tree | Problem 297 | Solution |
| Problem | LeetCode Link | Solution |
|---|---|---|
| Implement Trie (Prefix Tree) | Problem 208 | Solution |
| Design Add and Search Words Data Structure | Problem 211 | Solution |
| Word Search II | Problem 212 | Solution |
| Problem | LeetCode Link | Solution |
|---|---|---|
| Kth Largest Element in a Stream | Problem 703 | Solution |
| Last Stone Weight | Problem 1046 | Solution |
| K Closest Points to Origin | Problem 973 | Solution |
| Kth Largest Element in an Array | Problem 215 | Solution |
| Task Scheduler | Problem 621 | Solution |
| Design Twitter | Problem 355 | Solution |
| Find Median from Data Stream | Problem 295 | Solution |
| Problem | LeetCode Link | Solution |
|---|---|---|
| Subsets | Problem 78 | Solution |
| Combination Sum | Problem 39 | Solution |
| Permutations | Problem 46 | Solution |
| Subsets II | Problem 90 | Solution |
| Combination Sum II | Problem 40 | Solution |
| Word Search | Problem 79 | Solution |
| Palindrome Partitioning | Problem 131 | Solution |
| Letter Combinations of a Phone Number | Problem 17 | Solution |
| N-Queens | Problem 51 | Solution |
| Problem | LeetCode Link | Solution |
|---|---|---|
| Number of Islands | Problem 200 | Solution |
| Clone Graph | Problem 133 | Solution |
| Max Area of Island | Problem 695 | Solution |
| Pacific Atlantic Water Flow | Problem 417 | Solution |
| Surrounded Regions | Problem 130 | Solution |
| Rotting Oranges | Problem 994 | Solution |
| Walls and Gates | Problem 286 | Solution |
| Course Schedule | Problem 207 | Solution |
| Course Schedule II | Problem 210 | Solution |
| Redundant Connection | Problem 684 | Solution |
| Number of Connected Components in an Undirected Graph | Problem 323 | Solution |
| Graph Valid Tree | Problem 261 | Solution |
| Word Ladder | Problem 127 | Solution |
| Number of Provinces | Problem 547 | Solution |
| Problem | LeetCode Link | Solution |
|---|---|---|
| Climbing Stairs | Problem 70 | Solution |
| Min Cost Climbing Stairs | Problem 746 | Solution |
| House Robber | Problem 198 | Solution |
| House Robber II | Problem 213 | Solution |
| Longest Palindromic Substring | Problem 5 | Solution |
| Palindromic Substrings | Problem 647 | Solution |
| Decode Ways | Problem 91 | Solution |
| Coin Change | Problem 322 | Solution |
| Maximum Product Subarray | Problem 152 | Solution |
| Word Break | Problem 139 | Solution |
| Longest Increasing Subsequence | Problem 300 | Solution |
| Problem | LeetCode Link | Solution |
|---|---|---|
| Maximum Subarray | Problem 53 | Solution |
| Jump Game | Problem 55 | Solution |
| Gas Station | Problem 134 | Solution |
| Minimum Number of Taps to Open to Water a Garden | Problem 1526 | Solution |
| Problem | LeetCode Link | Solution |
|---|---|---|
| Single Number | Problem 136 | Solution |
| Number of 1 Bits | Problem 191 | Solution |
| Missing Number | Problem 268 | Solution |
| Problem | LeetCode Link | Solution |
|---|---|---|
| Aggregate Function | ❌ | Solution |
Each solution is implemented in JavaScript and can be run independently. The solutions are organized by problem-solving technique/data structure for easier navigation and learning.
Feel free to contribute by:
- Adding missing solutions
- Optimizing existing solutions
- Adding explanations or comments
- Fixing bugs
This project is for educational purposes.