mdmzfzl
NeetCode-Solutions
C++

My solutions in C++, Python and Rust for problems on NeetCode.io

Last updated Jul 3, 2026
299
Stars
68
Forks
1
Issues
0
Stars/day
Attention Score
28
Language breakdown
C++ 45.3%
Rust 32.4%
Python 21.9%
C# 0.4%
โ–ธ Files click to expand
README

What is NeetCode 150?

Neetcode 150 is a curated list of 150 LeetCode problems designed to cover all topics in data structures. It is an invaluable resource to study for LeetCode-style interviews you might enounter at FAANG and other big tech companies. There are several categories of questions and inside each category are easy, medium, and hard questions.

Creator's original repository and website.

Below is a list of my solutions for all the problems in C++, Python and Rust.

To contribute, see here.

Arrays & Hashing

| LeetCode ID | Difficulty | Problem | Solution | | ----------- | ---------- | ------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | 217 | Easy | Contains Duplicate | C++PythonRust | | 242 | Easy | Valid Anagram | C++PythonRust | | 1 | Easy | Two Sum | C++PythonRust | | 49 | Medium | Group Anagrams | C++PythonRust | | 347 | Medium | Top K Frequent Elements | C++PythonRust | | 238 | Medium | Product of Array Except Self | C++PythonRust | | 36 | Medium | Valid Sudoku | C++PythonRust | | 271 | Medium | Encode and Decode Strings | C++PythonRust | | 128 | Medium | Longest Consecutive Sequence | C++PythonRust |

Two Pointers

| LeetCode ID | Difficulty | Problem | Solution | | ----------- | ---------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | 125 | Easy | Valid Palindrome | C++PythonRust | | 167 | Medium | Two Sum II | C++PythonRust | | 15 | Medium | 3Sum | C++PythonRust | | 11 | Medium | Container with Most Water | C++PythonRust | | 42 | Hard | Trapping Rain Water | C++PythonRust |

Sliding Window

| LeetCode ID | Difficulty | Problem | Solution | | ----------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | 121 | Easy | Best Time to Buy & Sell Stock | C++PythonRust | | 3 | Medium | Longest Substring Without Repeating Characters | C++PythonRust | | 424 | Medium | Longest Repeating Character Replacement | C++PythonRust | | 567 | Medium | Permutation in String | C++PythonRust | | 76 | Hard | Minimum Window Substring | C++PythonRust | | 239 | Hard | Sliding Window Maximum | C++PythonRust |

Stack

| LeetCode ID | Difficulty | Problem | Solution | | ----------- | ---------- | --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 20 | Easy | Valid Parentheses | C++PythonRust | | 155 | Medium | Min Stack | C++PythonRust | | 150 | Medium | Evaluate Reverse Polish Notation | C++PythonRust | | 22 | Medium | Generate Parentheses | C++PythonRust | | 739 | Medium | Daily Temperatures | C++PythonRust | | 853 | Medium | Car Fleet | C++PythonRust | | 84 | Hard | Largest Rectangle in Histogram | C++PythonRust |

Binary Search

| LeetCode ID | Difficulty | Problem | Solution | | ----------- | ---------- | ----------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 704 | Easy | Binary Search | C++PythonRust | | 74 | Medium | Search a 2D Matrix | C++PythonRust | | 875 | Medium | Koko Eating Bananas | C++PythonRust | | 33 | Medium | Search in Rotated Sorted Array | C++PythonRust | | 153 | Medium | Find Minimum in Rotated Sorted Array | C++PythonRust | | 981 | Medium | Time Based Key-Value Store | C++PythonRust | | 4 | Hard | Median of Two Sorted Arrays | C++PythonRust |

Linked List

| LeetCode ID | Difficulty | Problem | Solution | | ----------- | ---------- | --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 206 | Easy | Reverse Linked List | C++PythonRust | | 21 | Easy | Merge Two Sorted Lists | C++PythonRust | | 143 | Medium | Reorder List | C++PythonRust | | 19 | Medium | Remove Nth Node From End of List | C++PythonRust | | 141 | Easy | Copy List with Random Pointer | C++PythonRust | | 2 | Medium | Add Two Numbers | C++PythonRust | | 141 | Easy | Linked List Cycle | C++PythonRust | | 287 | Medium | Find the Duplicate Number | C++PythonRust | | 146 | Medium | LRU Cache | C++PythonRust | | 23 | Hard | Merge k Sorted Lists | C++PythonRust | | 25 | Hard | Reverse Nodes in k-Group | C++PythonRust |

Trees

| LeetCode ID | Difficulty | Problem | Solution | | ----------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 226 | Easy | Invert Binary Tree | C++PythonRust | | 104 | Easy | Maximum Depth of Binary Tree | C++PythonRust | | 543 | Easy | Diameter of Binary Tree | C++PythonRust | | 110 | Easy | Balanced Binary Tree | C++PythonRust | | 100 | Easy | Same Tree | C++PythonRust | | 572 | Easy | Subtree Of Another Tree | C++PythonRust | | 235 | Medium | Lowest Common Ancestor Of A Binary Search Tree | C++PythonRust | | 102 | Medium | Binary Tree Level Order Traversal | C++PythonRust | | 199 | Medium | Binary Tree Right Side View | C++PythonRust | | 1448 | Medium | Count Good Nodes in Binary Tree | C++PythonRust | | 98 | Medium | Validate Binary Search Tree | C++PythonRust | | 230 | Medium | Kth Smallest Element in a BST | C++PythonRust | | 105 | Medium | Construct Binary Tree from Preorder and Inorder Traversal | C++PythonRust | | 124 | Hard | Binary Tree Maximum Path Sum | C++PythonRust | | 297 | Hard | Serialize and Deserialize Binary Tree | C++PythonRust |

Tries

| LeetCode ID | Difficulty | Problem | Solution | | ----------- | ---------- | ----------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 208 | Medium | Implement Trie (Prefix Tree) | C++PythonRust | | 211 | Medium | Design Add and Search Words Data Structure | C++PythonRust | | 212 | Hard | Word Search II | C++PythonRust |

Heap / Priority Queue

| LeetCode ID | Difficulty | Problem | Solution | | ----------- | ---------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | 703 | Easy | Kth Largest Element in a Stream | C++PythonRust | | 1046 | Easy | Last Stone Weight | C++PythonRust | | 973 | Medium | K Closest Points to Origin | C++PythonRust | | 215 | Medium | Kth Largest Element in an Array | C++PythonRust | | 621 | Medium | Task Scheduler | C++PythonRust | | 355 | Medium | Design Twitter | C++PythonRust | | 295 | Hard | Find Median from Data Stream | C++PythonRust |

Backtracking

| LeetCode ID | Difficulty | Problem | Solution | | ----------- | ---------- | ------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | 78 | Medium | Subsets | C++PythonRust | | 39 | Medium | Combination Sum | C++PythonRust | | 46 | Medium | Permutations | C++PythonRust | | 90 | Medium | Subsets II | C++PythonRust | | 40 | Medium | Combination Sum II | C++PythonRust | | 79 | Medium | Word Search | C++PythonRust | | 131 | Medium | Palindrome Partitioning | C++PythonRust | | 17 | Medium | Letter Combinations of a Phone Number | C++PythonRust | | 51 | Hard | N-Queens | C++PythonRust |

Graphs

| LeetCode ID | Difficulty | Problem | Solution | | ----------- | ---------- | --------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | 200 | Medium | Number of Islands | C++PythonRust | | 133 | Medium | Clone Graph | C++PythonRust | | 695 | Medium | Max Area of Island | C++PythonRust | | 417 | Medium | Pacific Atlantic Water Flow | C++PythonRust | | 130 | Medium | Surrounded Regions | C++PythonRust | | 994 | Medium | Rotting Oranges | C++PythonRust | | 286 | Medium | Walls and Gates | C++PythonRust | | 207 | Medium | Course Schedule | C++PythonRust | | 210 | Medium | Course Schedule II | C++PythonRust | | 684 | Medium | Redundant Connection | C++PythonRust | | 323 | Medium | Number of Connected Components In An Undirected Graph | C++PythonRust | | 261 | Medium | Graph Valid Tree | C++PythonRust | | 127 | Hard | Word Ladder | C++PythonRust |

Advanced Graphs

| LeetCode ID | Difficulty | Problem


README truncated. View on GitHub
๐Ÿ”— More in this category

ยฉ 2026 GitRepoTrend ยท mdmzfzl/NeetCode-Solutions ยท Updated daily from GitHub