A collection of solutions to LeetCode problems — written mainly in C++, with several in Python, and a few in other languages. This repo tracks my problem-solving journey, focusing on clean, efficient, and well-structured code.
- Per-problem directories: Each folder (e.g.,
1-two-sum,417-pacific-atlantic-water-flow) contains the solutions and notes for a single LeetCode problem, keeping language-specific implementations scoped to that challenge. - Language-specific files: Most problems provide a C++ implementation that follows LeetCode’s
Solutionsignature. Many also include Python versions that emphasize readability and leverage idiomatic features. - Documentation on demand: Numerous problem folders ship with mini
README.mdnotes describing the chosen approach for quicker future review.
- C++ — primary language with STL-driven approaches (vectors, maps, sets, priority queues) tuned for performance.
- Python — secondary language when concise syntax or dynamic typing helps express the algorithm more clearly.
- Others (occasional) — Java, JavaScript, or other languages for alternative perspectives while preserving LeetCode-friendly signatures.
Covers almost every major LeetCode domain, including:
- Arrays, Strings, Linked Lists, and interval manipulation
- Hash Maps, Sets, Heaps, and priority queues
- Two Pointers, Sliding Window, Stack, and Queue techniques
- Recursion & Backtracking for combinatorics and search
- Dynamic Programming (1D, 2D, bitmask/state-based)
- Trees, Graphs, BFS/DFS, and union-find connectivity
- Binary Search, Sorting, and Greedy Algorithms
- Bit Manipulation, Math, and Number Theory
- Prefix Sums, Monotonic Structures, and advanced DP patterns
Basically — everything LeetCode has to offer.
- Consistency with LeetCode interfaces: Classes and method signatures mirror the platform, enabling quick submission without refactoring.
- Modular helpers: Larger challenges break logic into helper routines (validators, recursive explorers) to keep solutions readable.
- Performance awareness: Solutions deliberately balance time/space trade-offs—using in-place updates, hashing, or sorting where it matters.
- Unified testing harness: Add GoogleTest/pytest scaffolding to exercise solutions locally.
- Complexity notes or benchmarks: Document time/space expectations alongside each solution for faster recall.
- Language parity: Expand Python or other-language counterparts to complement C++-only problems.
- Lightweight CI: Lint and test across languages to keep the repository evergreen.
To master problem patterns, strengthen data structures & algorithms intuition, and build consistency through practice.
- LeetCode: LeetCode Profile
Star the repo if you’re on the same grind — consistency beats luck.