A collection of 374 solved LeetCode problems in C++, organized by difficulty. Whether you're preparing for coding interviews or sharpening your problem-solving skills, feel free to explore!
| Difficulty | Solved | Folder |
|---|---|---|
| π’ Easy | 168 | Easy Problems |
| π‘ Medium | 177 | Medium Problems |
| π΄ Hard | 29 | Hard Problems |
| Total | 374 |
π Bonus Easy Problems (unnumbered)
| Problem | Solution |
|---|---|
| Complement of Base 10 | C++ |
| Number of 1 Bits | C++ |
| Number Complement | C++ |
| Pascal's Triangle | C++ |
| Pascal's Triangle II | C++ |
| Sqrt Number (without built-in) | C++ |
| Subtract Product and Sum of Digits | C++ |
| Subarray Sum Equals Target | C++ |
π Bonus Medium Problems (unnumbered)
| Problem | Solution |
|---|---|
| 3Sum | C++ |
| Delete Kth Node from End | C++ |
| Distinct Array & Target Integer Combinations | C++ |
| Find All Duplicates in an Array | C++ |
| Reverse a Number | C++ |
| Rotate Array | C++ |
| Sort Colors (Dutch National Flag) | C++ |
π Bonus Hard Problems (unnumbered)
| Problem | Solution |
|---|---|
| Median of Two Sorted Arrays | C++ |
| Reverse Nodes in k-Group | C++ |
| Topic | Example Problems |
|---|---|
| Arrays & Hashing | Two Sum, Product of Array Except Self, Majority Element |
| Two Pointers | 3Sum Closest, Two Sum II, Move Zeroes, Boats to Save People |
| Sliding Window | Grumpy Bookstore Owner, Get Equal Substrings Within Budget |
| Binary Search | Search in Rotated Sorted Array, Find Peak Element, Binary Search |
| Linked Lists | Merge k Sorted Lists, Reverse Linked List, Linked List Cycle |
| Trees | Maximum Depth of Binary Tree, Path Sum, LCA, Serialize BST |
| Stacks | Valid Parentheses, Remove All Adjacent Duplicates |
| Sorting | Sort an Array, Sort List, Insertion Sort List |
| Bit Manipulation | Single Number, Counting Bits, XOR Queries |
| Dynamic Programming | Climbing Stairs, Fibonacci, Stone Game II, Domino Tiling |
| Greedy | Assign Cookies, Lemonade Change, IPO, Patching Array |
| Graphs | Path with Maximum Probability, Regions Cut By Slashes |
| Matrix | Spiral Matrix, Search a 2D Matrix, Toeplitz Matrix |
| Math | Factorial Trailing Zeroes, Power of Two/Three/Four |
| Strings | String Compression, Valid Anagram, Merge Strings Alternately |
-
Clone the repo
git clone <repo-url> cd LeetCode-Problems
-
Compile any solution
g++ -std=c++17 -o solution "Easy Problems/1_Two-sum.cpp" ./solution -
Browse by difficulty β use the tables above or navigate the folders directly.
Found a better approach? Want to add a new solution? PRs are welcome!
- Fork the repository
- Add your solution in the appropriate difficulty folder
- Follow the naming convention:
<number>_<Problem_Name>.cpp - Submit a pull request
β Star this repo if you find it helpful!