A repository of my daily programming practice tackling LeetCode problems in C++
— by Mayank Kumar (01mayankk)
This repository contains my solutions to problems from LeetCode.
Each directory is named according to the problem number and title (e.g., 0001-two-sum, 0014-longest-common-prefix, etc.).
All code is written in C++ and submitted regularly as part of my daily coding routine.
- Track progress: Maintain a structured log of solved problems with increasing difficulty.
- Showcase skills: Demonstrate proficiency in algorithms, data structures, and problem-solving (valuable for interviews).
- Build habit: Practice consistently and cover a broad range of problem types (arrays, strings, graphs, trees, DP, etc.).
- Provide reference: Use my solutions as a personal study tool and potentially assist peers who are learning.
Leetcode-solutions/
├── 0001-two-sum/
│ ├── two_sum.cpp
│ └── README.md ← optional notes for that problem
├── 0003-longest-substring-without-repeating-characters/
│ ├── solution.cpp
│ └── ...
├── 0014-longest-common-prefix/
│ ├── longest_common_prefix.cpp
│ └── ...
├── …
└── README.md ← this file
- Folder naming convention:
XXXX-problem-titlewhereXXXXis the zero-padded LeetCode problem number. - Files inside: Each solution folder contains C++ source code (
.cpp) and optionally notes or comments in aREADME.md.
- Browse by number: Navigate folders by problem number to find the solution you’re interested in.
- View code: Open the
.cppfile to review approach, logic, and comments. - Run locally: Copy the code to your environment (Visual Studio, CLion, g++, etc.) and test with custom input or test cases.
- Study & compare: Use as a reference – compare your own implementation, learn new patterns, and improve.
- Solutions span from easy to hard problems, covering a wide array of themes (sliding window, hash tables, recursion, graphs, dynamic programming).
- Each problem is solved in C++, showcasing handle over language features (STL, pointers, smart memory, high-performance code).
- A consistent naming pattern and organized folder structure make it easy to navigate and scale.
- Although I include comments in my code, I encourage you to add your own comments or experiment further (e.g., alternative algorithms, time/space optimizations).
- Use this as study material, not as a substitute for solving the problems yourself — the real learning happens when you attempt the problem first.
- Feel free to fork or clone the repository if you’d like to explore the solutions — and consider adding your own improvements or variants.
- This repo is primarily for my personal study, but if you spot errors, would like to discuss a solution, or want to suggest improvements, feel free to reach out via GitHub.
- If you’d like to submit enhancements (e.g., additional comments, alternative solutions), you are welcome to fork the repo and submit a pull request.
This project is open-source for educational purposes. Feel free to use it as a reference and learning tool.
“Code is best understood when you re-type it, debug it, and write it yourself.”
Keeps solving, keep growing.
— Mayank Kumar
| Problem Name | Difficulty |
|---|---|
| 1545-find-kth-bit-in-nth-binary-string | Medium |
| Problem Name | Difficulty |
|---|---|
| 0874-walking-robot-simulation | Medium |
| 1545-find-kth-bit-in-nth-binary-string | Medium |
| 1914-cyclically-rotating-a-grid | Medium |
| 2069-walking-robot-simulation-ii | Medium |
| 2075-decode-the-slanted-ciphertext | Medium |
| 2149-rearrange-array-elements-by-sign | Medium |
| 2553-separate-the-digits-in-an-array | Easy |
| 2751-robot-collisions | Hard |
| 2946-matrix-similarity-after-cyclic-shifts | Easy |
| 3653-xor-after-range-multiplication-queries-i | Medium |
| Problem Name | Difficulty |
|---|---|
| 0239-sliding-window-maximum | Hard |
| 1888-minimum-number-of-flips-to-make-the-binary-string-alternating | Medium |
| Problem Name | Difficulty |
|---|---|
| 1415-the-k-th-lexicographical-string-of-all-happy-strings-of-length-n | Medium |
| 1980-find-unique-binary-string | Medium |
| Problem Name | Difficulty |
|---|---|
| 1009-complement-of-base-10-integer | Easy |
| Problem Name | Difficulty |
|---|---|
| 1391-check-if-there-is-a-valid-path-in-a-grid | Medium |
| 1559-detect-cycles-in-2d-grid | Medium |
| 1722-minimize-hamming-distance-after-swap-operations | Medium |
| 2573-find-the-string-with-lcp | Hard |
| 3600-maximize-spanning-tree-stability-with-upgrades | Hard |
| Problem Name | Difficulty |
|---|---|
| 3600-maximize-spanning-tree-stability-with-upgrades | Hard |
| Problem Name | Difficulty |
|---|---|
| 3600-maximize-spanning-tree-stability-with-upgrades | Hard |
| Problem Name | Difficulty |
|---|---|
| 0239-sliding-window-maximum | Hard |
| 1878-get-biggest-three-rhombus-sums-in-a-grid | Medium |
| 3296-minimum-number-of-seconds-to-make-mountain-height-zero | Medium |
| Problem Name | Difficulty |
|---|---|
| 1622-fancy-sequence | Hard |
| 2069-walking-robot-simulation-ii | Medium |
| Problem Name | Difficulty |
|---|---|
| 1622-fancy-sequence | Hard |
| Problem Name | Difficulty |
|---|---|
| 0015-3sum | Medium |
| 0026-remove-duplicates-from-sorted-array | Easy |
| 0027-remove-element | Easy |
| 0031-next-permutation | Medium |
| 0061-rotate-list | Medium |
| 0080-remove-duplicates-from-sorted-array-ii | Medium |
| 0088-merge-sorted-array | Easy |
| 0125-valid-palindrome | Easy |
| 0167-two-sum-ii-input-array-is-sorted | Medium |
| 0189-rotate-array | Medium |
| 1855-maximum-distance-between-a-pair-of-values | Medium |
| 1861-rotating-the-box | Medium |
| 2149-rearrange-array-elements-by-sign | Medium |
| 3643-flip-square-submatrix-vertically | Easy |
| Problem Name | Difficulty |
|---|---|
| 3546-equal-sum-grid-partition-i | Medium |
| 3548-equal-sum-grid-partition-ii | Hard |
| Problem Name | Difficulty |
|---|---|
| 0796-rotate-string | Easy |
| 3474-lexicographically-smallest-generated-string | Hard |
| Problem Name | Difficulty |
|---|---|
| 2751-robot-collisions | Hard |
| Problem Name | Difficulty |
|---|---|
| 0053-maximum-subarray | Medium |
| 0169-majority-element | Easy |
| 3653-xor-after-range-multiplication-queries-i | Medium |
| 3655-xor-after-range-multiplication-queries-ii | Hard |
| Problem Name | Difficulty |
|---|---|
| 0239-sliding-window-maximum | Hard |
| Problem Name | Difficulty |
|---|---|
| 0239-sliding-window-maximum | Hard |
| Problem Name | Difficulty |
|---|---|
| 0637-average-of-levels-in-binary-tree | Easy |
| 1391-check-if-there-is-a-valid-path-in-a-grid | Medium |
| 1559-detect-cycles-in-2d-grid | Medium |
| 1722-minimize-hamming-distance-after-swap-operations | Medium |
| Problem Name | Difficulty |
|---|---|
| 2452-words-within-two-edits-of-dictionary | Medium |
| Problem Name | Difficulty |
|---|---|
| 0169-majority-element | Easy |
| 0383-ransom-note | Easy |
| 2833-furthest-point-from-origin | Easy |
| Problem Name | Difficulty |
|---|---|
| 3464-maximize-the-distance-between-points-on-a-square | Hard |
| Problem Name | Difficulty |
|---|---|
| 0637-average-of-levels-in-binary-tree | Easy |
| 1391-check-if-there-is-a-valid-path-in-a-grid | Medium |
| 1559-detect-cycles-in-2d-grid | Medium |
| 3629-minimum-jumps-to-reach-end-via-prime-teleportation | Medium |
| Problem Name | Difficulty |
|---|---|
| 0637-average-of-levels-in-binary-tree | Easy |
| Problem Name | Difficulty |
|---|---|
| 0637-average-of-levels-in-binary-tree | Easy |
| Problem Name | Difficulty |
|---|---|
| 0061-rotate-list | Medium |
| Problem Name | Difficulty |
|---|---|
| 3629-minimum-jumps-to-reach-end-via-prime-teleportation | Medium |