Skip to content

Contains in-depth LeetCode solutions using CPP with multiple approaches, categorised by Patterns. Designed for quick reference during placement preparation. Currently implementing top 500 problems.

Notifications You must be signed in to change notification settings

BenGJ10/Leetcode-Solutions-Tracker

Repository files navigation

LeetCode C++ Solutions

This repository contains my C++ solutions for various LeetCode problems, organized by category. Each entry links to the original problem, shows its difficulty, and links to the solution file. This README serves as a quick reference guide to navigate through the solutions. The solutions are categorized based on the type of problem or algorithm used. Each solution file has complete information about the problem, including the problem statement, constraints, and the implemented solution.


Arrays

Problem Difficulty Solution
41. First Missing Positive Hard Solution
53. Maximum Subarray Medium Solution
56. Merge Intervals Medium Solution
75. Sort Colors Medium Solution
128. Longest Consecutive Sequence Medium Solution
134. Gas Station Medium Solution
138. Copy List with Random Pointer Medium Solution
189. Rotate Array Medium Solution
229. Majority Element II Medium Solution
268. Missing Number Easy Solution
274. H-Index Medium Solution
287. Find the Duplicate Number Medium Solution
324. Wiggle Sort II Medium Solution
442. Find All Duplicates in an Array Medium Solution
485. Max Consecutive Ones Easy Solution
1752. Check if Array Is Sorted and Rotated Easy Solution
2615. Sum of Distances Medium Solution

Strings

Problem Difficulty Solution
8. String to Integer (atoi) Medium Solution
12. Integer to Roman Medium Solution
14. Longest Common Prefix Easy Solution
38. Count and Say Medium Solution
49. Group Anagrams Medium Solution
151. Reverse Words in a String Medium Solution
205. Isomorphic Strings Easy Solution
290. Word Pattern Easy Solution
392. Is Subsequence Easy Solution
443. String Compression Medium Solution
451. Sort Characters By Frequency Medium Solution

Matirx

Problem Difficulty Solution
48. Rotate Image Medium Solution
54. Spiral Matrix Medium Solution
59. Spiral Matrix II Medium Solution
73. Set Matrix Zeroes Medium Solution
74. Search a 2D Matrix Medium Solution
867. Transpose Matrix Easy Solution

Two Pointers

Problem Difficulty Solution
11. Container With Most Water Medium Solution
15. 3Sum Medium Solution
42. Trapping Rain Water Hard Solution
80. Remove Duplicates from Sorted Array II Medium Solution
167. Two Sum II - Input Array Is Sorted Medium Solution
922. Sort Array By Parity II Easy Solution
2149. Rearrange Array Elements by Sign Medium Solution
2161. Partition Array According to Given Pivot Medium Solution

Prefix Sum

Problem Difficulty Solution
238. Product of Array Except Self Medium Solution
304. Range Sum Query 2D - Immutable Medium Solution
523. Continuous Subarray Sum Medium Solution
525. Contiguous Array Medium Solution
560. Subarray Sum Equals K Medium Solution
724. Find Pivot Index Easy Solution

Sliding Window

Problem Difficulty Solution
3. Longest Substring Without Repeating Characters Medium Solution
76. Minimum Window Substring Hard Solution
209. Minimum Size Subarray Sum Medium Solution
424. Longest Repeating Character Replacement Medium Solution
713. Subarray Product Less Than K Medium Solution
930. Binary Subarrays With Sum Medium Solution
992. Subarrays with K Different Integers Hard Solution
1004. Max Consecutive Ones III Medium Solution
1358. Number of Substrings Containing All Three Characters Medium Solution
1423. Maximum Points You Can Obtain from Cards Medium Solution
2302. Count Subarrays Where the Score Is Less Than k Hard Solution
2461. Maximum Sum of Distinct Subarrays With Length K Medium Solution

Binary Search

Problem Difficulty Solution
4. Median of Two Sorted Arrays Hard Solution
34. Find First and Last Position of Element in Sorted Array Easy Solution
69. Sqrt(x) Easy Solution
81. Search in Rotated Sorted Array II Medium Solution
153. Find Minimum in Rotated Sorted Array Medium Solution
154. Find Minimum in Rotated Sorted Array II Medium Solution
162. Find Peak Element Medium Solution
410. Split Array Largest Sum Hard Solution
540. Single Element in a Sorted Array Medium Solution
744. Find Smallest Letter Greater Than Target Easy Solution
875. Koko Eating Bananas Medium Solution
1011. Capacity To Ship Packages Within D Days Medium Solution
1482. Minimum Number of Days to Make m Bouquets Medium Solution
1552. Magnetic Force Between Two Balls Medium Solution
1870. Minimum Speed to Arrive on Time Medium Solution
1901. Find a Peak Element II Medium Solution
2187. Minimum Time to Complete Trips Medium Solution
2226. Maximum Candies Allocated to K Children Medium Solution
2300. Successful Pairs of Spells and Potions Medium Solution
2517. Maximum Tastiness of Candy Basket Medium Solution

Stacks and Queues

Problem Difficulty Solution
20. Valid Parentheses Easy Solution
84. Largest Rectangle in Histogram Hard Solution
85. Maximal Rectangle Hard Solution
150. Evaluate Reverse Polish Notation Medium Solution
155. Min Stack Medium Solution
224. Basic Calculator Hard Solution
227. Basic Calculator II Medium Solution
239. Sliding Window Maximum Hard Solution
402. Remove K Digits Medium Solution
496. Next Greater Element I Easy Solution
503. Next Greater Element II Medium Solution
739. Daily Temperatures Medium Solution
853. Car Fleet Medium Solution
901. Online Stock Span Medium Solution
907. Sum of Subarray Minimums Medium Solution
2104. Sum of Subarray Ranges Medium Solution

Stacks and Queues Implementation

Problem Difficulty Solution
Stack using Arrays Easy Solution
Queue using Arrays Easy Solution
Stack using Queue Easy Solution
Queue using Stack Easy Solution
Previous Smaller Element Medium Solution

Linked Lists

Problem Difficulty Solution
2. Add Two Numbers Medium Solution
19. Remove Nth Node From End of List Medium Solution
23. Merge k Sorted Lists Hard Solution
61. Rotate List Medium Solution
86. Partition List Medium Solution
92. Reverse Linked List II Medium Solution
141. Linked List Cycle Easy Solution
142. Linked List Cycle II Medium Solution
143. Reorder List Medium Solution
148. Sort List Medium Solution
160. Intersection of Two Linked Lists Easy Solution
206. Reverse Linked List Easy Solution
237. Delete Node in a Linked List Medium Solution
328. Odd Even Linked List Medium Solution
445. Add Two Numbers II Medium Solution
876. Middle of the Linked List Easy Solution
2095. Delete the Middle Node of a Linked List Medium Solution

Recursion and Backtracking

Problem Difficulty Solution
17. Letter Combinations of a Phone Number Medium Solution
37. Sudoku Solver Hard Solution
39. Combination Sum Medium Solution
40. Combination Sum II Medium Solution
46. Permutations Medium Solution
50. Pow(x, n) Medium Solution
90. Subsets II Medium Solution
131. Palindrome Partitioning Medium Solution
216. Combination Sum III Medium Solution
1922. Count Good Numbers Medium Solution

BFS and DFS in Graphs

Problem Difficulty Solution
126. Word Ladder II Hard Solution
127. Word Ladder Hard Solution
130. Surrounded Regions Medium Solution
133. Clone Graph Medium Solution
200. Number of Islands Medium Solution
399. Evaluate Division Medium Solution
417. Pacific Atlantic Water Flow Medium Solution
433. Minimum Genetic Mutation Medium Solution
542. 01 Matrix Medium Solution
695. Max Area of Island Medium Solution
752. Open the Lock Medium Solution
773. Flood Fill Easy Solution
785. Is Graph Bipartite Medium Solution
909. Snakes and Ladders Medium Solution
994. Rotting Oranges Medium Solution
1020. Number of Enclaves Medium Solution

Topological Sorting in Graphs

Problem Difficulty Solution
207. Course Schedule Medium Solution
210. Course Schedule II Medium Solution
802. Find Eventual Safe States Medium Solution

Shortest Path Algorithms in Graphs

Problem Difficulty Solution
743. Network Delay Time Medium Solution
787. Cheapest Flights Within K Stops Medium Solution
1091. Shortest Path in Binary Matrix Medium Solution
1334. City with the Smallest Number of Neighbors Medium Solution
1631. Path With Minimum Effort Medium Solution
1976. Number of Ways to Arrive at Destination Medium Solution

Minimum Spanning Tree & Disjoint Set in Graphs

Problem Difficulty Solution
547. Number of Provinces Medium Solution
684. Redundant Connection Medium Solution
947. Most Stones Removed with Same Row or Column Medium Solution
1319. Operations to Make Network Connected Medium Solution

Graph Miscellaneous

Problem Difficulty Solution
Topological Sorting - DFS Medium Solution
Topological Sorting - BFS Medium Solution
Shortest Path in DAG Hard Solution
Dijkstra's Algorithm Medium Solution
Bellmann Ford Algorithm Medium Solution
Floyd Warshall (APSP) Medium Solution
Prim's Algorithm (MST) Medium Solution
Disjoint Set (Union by Rank) Medium Solution

About

Contains in-depth LeetCode solutions using CPP with multiple approaches, categorised by Patterns. Designed for quick reference during placement preparation. Currently implementing top 500 problems.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages