A collection of 50 LeetCode problems solved in C++ (C++17).
| Category | Count | Examples |
|---|---|---|
| Easy | 25 | Two Sum, Valid Parentheses, Merge Two Sorted Lists |
| Medium | 15 | 3Sum, LRU Cache, Add Two Numbers |
| Hard | 10 | Median of Two Sorted Arrays, N-Queens, Trapping Rain Water |
| Total | 50 |
Each file is named with the problem number and title (e.g., 001-TwoSum.cpp).
The files include:
- Problem Description & Link
- Time & Space Complexity Analysis
- Complete Solution Class
- Helper
main()function for local testing
You can compile any solution using a standard C++ compiler (like g++ or clang++).
# Example
g++ 001-TwoSum.cpp -o TwoSum
./TwoSum- Two Sum
- Reverse Integer
- Palindrome Number
- Roman to Integer
- Longest Common Prefix
- Valid Parentheses
- Merge Two Sorted Lists
- Remove Duplicates from Sorted Array
- Remove Element
- Implement strStr()
- Search Insert Position
- Maximum Subarray
- Length of Last Word
- Plus One
- Add Binary
- Sqrt(x)
- Climbing Stairs
- Remove Duplicates from Sorted List
- Merge Sorted Array
- Binary Tree Inorder Traversal
- Same Tree
- Symmetric Tree
- Maximum Depth of Binary Tree
- Convert Sorted Array to Binary Search Tree
- Pascal's Triangle
- Add Two Numbers
- Longest Substring Without Repeating Characters
- Longest PalindromicSubstring
- Container With Most Water
- 3Sum
- Letter Combinations of a Phone Number
- Remove Nth Node From End of List
- Generate Parentheses
- Next Permutation
- Search in Rotated Sorted Array
- Find First and Last Position of Element in Sorted Array
- Valid Sudoku
- Group Anagrams
- Rotate Image
- LRU Cache
- Median of Two Sorted Arrays
- Regular Expression Matching
- Merge k Sorted Lists
- Reverse Nodes in k-Group
- Longest Valid Parentheses
- Sudoku Solver
- First Missing Positive
- Trapping Rain Water
- N-Queens
- SlidingWindowMaximum
Created by vardhan-the-dev