समाधान
LeetCode समाधान, कदम-दर-कदम समझाए गए
मेरे हल किए 310 प्रॉब्लम — हर एक के साथ intuition, approach, मेरा accepted कोड, complexity, animated test cases और line-by-line debugger।
समाधानों का विवरण अंग्रेज़ी में है।
Array42
Hashing / Anagram
Prefix Sum
Two Pointers
- 202. Happy Numberआसान
- 88. Merge Sorted Arrayआसान
- 283. Move Zeroesआसान
- 26. Remove Duplicates from Sorted Arrayआसान
- 27. Remove Elementआसान
- 125. Valid Palindromeआसान
- 167. Two Sum II - Input Array Is Sortedमध्यम
- 15. 3Sumमध्यम
- 16. 3Sum Closestमध्यम
- 18. 4Sumमध्यम
- 11. Container With Most Waterमध्यम
- 31. Next Permutationमध्यम
- 80. Remove Duplicates from Sorted Array IIमध्यम
- 189. Rotate Arrayमध्यम
- 75. Sort Colorsमध्यम
- 42. Trapping Rain Waterकठिन
Kadane
- 53. Maximum Subarrayमध्यम
Matrix
- 48. Rotate Imageमध्यम
- 73. Set Matrix Zeroesमध्यम
- 54. Spiral Matrixमध्यम
- 36. Valid Sudokuमध्यम
- 289. Game of Lifeमध्यम
Sorting
- 56. Merge Intervalsमध्यम
Cyclic Sort / Index Marking
Counting Sort
- 274. H-Indexमध्यम
Moore Voting
Linear Scan
Design
String18
Two Pointers
Palindrome / Expand Around Center
String Matching (KMP / Rabin-Karp)
Hashing / Frequency
Parsing / Conversion
Math
- 50. Pow(x, n)मध्यम
- 7. Reverse Integerमध्यम
Prefix / Misc
Sliding Window
Sliding Window14
Fixed Window
Variable Window – Longest
Variable Window – Shortest / Minimum
Counting Subarrays (Exactly K = AtMost K − AtMost K−1)
Window + Hashing (Multi-word)
Monotonic Queue
Prefix / Circular Window
Binary Search20
Basics / Lower & Upper Bound
Rotated Sorted Array
Peak / Check Mid Sides
Binary Search on Answer
2D Matrix
Two Sorted Arrays / Partition
Math / Missing Numbers
Design
Linked List20
Basics
Fast & Slow Pointers
Reversal
Merge
Palindrome
Reordering / Partition
- 86. Partition Listमध्यम
Intersection
Deep Copy / Multilevel
Design
- 146. LRU Cacheमध्यम
- 460. LFU Cacheकठिन
Sorting
- 148. Sort Listमध्यम
Arithmetic
- 2. Add Two Numbersमध्यम
Stack & Queue18
Parentheses / Bracket Matching
Stack Simulation / String Processing
Expression Evaluation
Stack / Queue Design
Iterator (Stack-based)
Queue Simulation
Monotonic Stack – Next / Previous Greater or Smaller
Monotonic Stack – Greedy Removal
- 402. Remove K Digitsमध्यम
Monotonic Stack – Contribution / Area
Tree33
Traversals (Recursive / Iterative)
DFS Basics
Root-to-Leaf Paths
BFS / Level Order
Lowest Common Ancestor / Distance
BST
Construction / Serialization
Heap8
Top K
Two Heaps
K-way Merge
Greedy + Heap / Scheduling
- 621. Task Schedulerमध्यम
Recursion & Backtracking18
Recursion Basics
Subsets
- 78. Subsetsमध्यम
- 90. Subsets IIमध्यम
Combinations
Permutations
Generate / Build Strings
Partitioning
Constraint Satisfaction
Grid Search / Backtracking DFS
- 79. Word Searchमध्यम
Greedy11
Sorting + Simple Greedy
Jump / Reachability
Local Choice / Two-pass
- 135. Candyकठिन
Graph40
Graph Fundamentals / BFS
- 133. Clone Graphमध्यम
- 200. Number of Islandsमध्यम
Graph Fundamentals / DFS
Graph Fundamentals / DFS + DSU
Multi-Source BFS
State-Space BFS
Bipartite / 2-Coloring
Topological Sort / DAG
State-Space / Transformation BFS
Shortest Path / Dijkstra
Shortest Path / Floyd-Warshall
Minimum Spanning Tree
Union Find / DSU
Bridges / Articulation Points
Graph DP
Shortest Path / BFS-Dijkstra
Graph Fundamentals / DFS-BFS
Dynamic Programming52
1D / Fibonacci
Kadane / Subarray DP
State Machine / Stocks
Grid DP
Triangle / Pascal
0/1 Knapsack / Subset Sum
Unbounded Knapsack
- 322. Coin Changeमध्यम
- 518. Coin Change IIमध्यम
- 279. Perfect Squaresमध्यम
String DP / Word Break
LCS
LIS
Palindrome / Interval DP
DP on Squares / Matrix
Game DP
- 1025. Divisor Gameआसान
- 877. Stone Gameमध्यम
DP on Array
- 403. Frog Jumpकठिन