A comprehensive collection of LeetCode solutions, Low-Level Design patterns, and System Design concepts
LeetCode • Visualizer • LLD • HLD • Resources
| Section | Description | Status |
|---|---|---|
| LeetCode | Curated problem solutions with detailed explanations | ✅ Active |
| Visualizer | Interactive step-by-step algorithm visualization | ✅ NEW |
| LLD (Java) | Object-Oriented Programming with Java examples | ✅ Active |
| LLD (Node.js) | OOP concepts implemented in JavaScript | ✅ Active |
| LLD (Python) | OOP patterns in Python | ✅ Active |
| HLD | High-Level Design & System Design | 🔜 Coming Soon |
Each problem includes: Question, Solution Code, and Detailed Explanation
Arrays & Hashing (click to expand)
| # | Problem | Description | Q-Card |
|---|---|---|---|
| 1 | Two Sum | Find 2 nums that add to target | Store num→idx in map, check if complement exists |
| 15 | 3Sum | Find triplets summing to 0 | Sort + fix one, two-pointer for rest, skip dupes |
| 1200 | Minimum Absolute Difference | Find pairs with min absolute difference | Sort array → check adjacent differences |
Stack (click to expand)
| # | Problem | Description | Q-Card |
|---|---|---|---|
| 20 | Valid Parentheses | Check if brackets are valid | Stack: push open, pop matching close |
| 85 | Maximal Rectangle | Largest rect of 1s in matrix | Convert to histogram per row, use monotonic stack |
Strings & Substrings (click to expand)
| # | Problem | Description | Q-Card |
|---|---|---|---|
| 3 | Longest Substring Without Repeating | Max substring with unique chars | Sliding window + set, shrink on duplicate |
| 521 | Longest Uncommon Subsequence I | Longest seq not in both strings | If strings differ → longer one wins |
| 522 | Longest Uncommon Subsequence II | Longest seq not subseq of others | Sort by len, check if subseq of any other |
| 524 | Longest Word in Dictionary | Longest dict word from deleting chars | Two-pointer subseq check, pick longest/smallest |
Binary Search (click to expand)
| # | Problem | Description | Q-Card |
|---|---|---|---|
| 4 | Median of Two Sorted Arrays | Find median of 2 sorted arrays | Binary search on smaller array, partition both |
| 3453 | Separate Squares I | Min Y for equal area split | Monotonic area → Binary Search on Y |
Dynamic Programming (click to expand)
| # | Problem | Description | Q-Card |
|---|---|---|---|
| 10 | Regular Expression Matching | Match string with . and * |
2D DP: * = zero or more of prev char |
| 514 | Freedom Trail | Min rotations to spell word on ring | DP on (ring pos, key idx), try all char positions |
| 1895 | Largest Magic Square | Largest k×k magic square in grid | Prefix sums for rows/cols, check all squares |
| 1937 | Max Points with Cost | Max points from grid with penalty | DP with left/right pass optimization |
| 3651 | Min Cost Path with Teleportations | Grid path with k free teleports | 1D DP + Suffix Minimum for O(1) teleport |
Sliding Window (click to expand)
| # | Problem | Description | Q-Card |
|---|---|---|---|
| 992 | Subarrays with K Distinct | Count subarrays with exactly K distinct | atMost(K) - atMost(K-1) trick |
| 995 | Min K Bit Flips | Min flips to make all 1s | Greedy flip at each 0, track flips with queue |
| 1423 | Max Points from Cards | Pick k cards from ends for max sum | Find min window of (n-k), answer = total - min |
| 1438 | Longest Subarray With Limit | Longest subarray where max-min ≤ limit | 2 monotonic deques: maxq (dec), minq (inc) |
| 1984 | Min Diff Between K Scores | Min diff in k consecutive elements | Sort + sliding window of size k |
Two Pointers (click to expand)
| # | Problem | Description | Q-Card |
|---|---|---|---|
| 1877 | Minimize Max Pair Sum | Min the max pair sum | Sort, pair smallest with largest |
| 1984 | Min Diff Between K Scores | Min diff in k consecutive elements | Sort + sliding window of size k |
Greedy (click to expand)
| # | Problem | Description | Q-Card |
|---|---|---|---|
| 1007 | Min Domino Rotations | Equal row by swapping top/bot | Check tops[0] & bottoms[0] as targets |
| 1877 | Minimize Max Pair Sum | Min the max pair sum | Sort, pair smallest with largest |
| 2943 | Maximize Square Hole Area | Max square hole from removing bars | Sort bars, find max consecutive bars |
| 2975 | Maximum Square Area | Max square from removing fences | All gaps: HashSet(H-gaps) ∩ V-gaps |
Backtracking (click to expand)
| # | Problem | Description | Q-Card |
|---|---|---|---|
| 17 | Letter Combinations | All letter combos from phone digits | Backtrack: choose→explore→unchoose for each digit |
| 22 | Generate Parentheses | All valid parenthesis combos | Back track: open < n, close < open |
| 526 | Beautiful Arrangement | Count permutations where i%perm[i]==0 or vice versa | Backtrack, try each unused num at each pos |
Trees & Graphs (click to expand)
| # | Problem | Description | Q-Card |
|---|---|---|---|
| 865 | Smallest Subtree with Deepest Nodes | LCA of all deepest nodes | DFS returns (depth, node), if L==R curr is LCA |
| 3650 | Min Cost Path with Edge Reversals | Min cost with optional edge reversal | Add reverse edges (2× cost), run Dijkstra |
| 3651 | Min Cost Path with Teleportations | Grid path with k free teleports | 1D DP + Suffix Min by cell value |
Linked Lists (click to expand)
| # | Problem | Description | Q-Card |
|---|---|---|---|
| 23 | Merge K Sorted Lists | Merge k sorted lists into one | D&C or MinHeap: O(N log k) |
Math & Geometry (click to expand)
| # | Problem | Description | Q-Card |
|---|---|---|---|
| 1266 | Min Time Visiting All Points | Min time to visit points (Chebyshev) | Max(abs(dx), abs(dy)) as diag = 1 sec |
| 3047 | Largest Square in Two Rects | Max square in intersection of any pair | Check all N² pairs, intersect is [maxL, minR] |
Matrix & Prefix Sum (click to expand)
| # | Problem | Description | Q-Card |
|---|---|---|---|
| 1895 | Largest Magic Square | Largest k×k magic square in grid | Prefix sums for rows/cols, check all squares |
| 1292 | Max Side Length with Sum <= Threshold | Max square with sum <= K | Prefix Sums + Binary Search maxLen |
Design (click to expand)
| # | Problem | Description | Q-Card |
|---|---|---|---|
| 535 | Encode Decode TinyURL | URL shortener design | Counter + Base62, dual HashMaps |
Bit Manipulation (click to expand)
| # | Problem | Description | Q-Card |
|---|---|---|---|
| 3314 | Construct Min Bitwise Array I | Find min x where x OR (x+1) = n | Odd: clear rightmost bit of trailing 1s |
Sweep Line (click to expand)
| # | Problem | Description | Q-Card |
|---|---|---|---|
| 3454 | Separate Squares II | Min Y for equal area (overlaps=union) | Sweep line events (y, type), merge intervals |
Click to expand
| # | Problem | Difficulty | Q-Card 💡 |
|---|---|---|---|
| 1 | Two Sum | 🟢 Easy | Map lookup: target - num exists? |
| 3 | Longest Substring Without Repeating | 🟡 Medium | Slide window + set, shrink on dupe |
| 4 | Median of Two Sorted Arrays | 🔴 Hard | Binary search smaller arr, partition both |
| 10 | Regular Expression Matching | 🔴 Hard | 2D DP, handle * = 0 or more prev |
| 15 | 3Sum | 🟡 Medium | Sort, fix 1, two-ptr rest, skip dupes |
| 17 | Letter Combinations | 🟡 Medium | Backtrack: choose→explore→unchoose |
| 20 | Valid Parentheses | 🟢 Easy | Stack: push open, pop matching close |
| 22 | Generate Parentheses | 🟡 Medium | Backtrack: open < n, close < open |
| 23 | Merge K Sorted Lists | 🔴 Hard | D&C or MinHeap: O(N log k) |
| 85 | Maximal Rectangle | 🔴 Hard | Histogram per row + Monotonic Stack |
| 514 | Freedom Trail | 🔴 Hard | DP(pos, idx), try all matching chars |
| 521 | Longest Uncommon Subsequence I | 🟢 Easy | Different strings? Longer wins |
| 522 | Longest Uncommon Subsequence II | 🟡 Medium | Check each if subseq of any other |
| 524 | Longest Word in Dictionary | 🟡 Medium | 2-ptr subseq check, longest/lex-smallest |
| 526 | Beautiful Arrangement | 🟡 Medium | Backtrack: try valid nums at each pos |
| 535 | Encode Decode TinyURL | 🟡 Medium | Counter + Base62, dual HashMaps |
| 712 | Min ASCII Delete Sum | 🟡 Medium | LCS variation: Total - 2*LCS_ASCII |
| 865 | Smallest Subtree with Deepest Nodes | 🟡 Medium | DFS return (depth, node), compare L/R depths |
| 992 | Subarrays with K Distinct | 🔴 Hard | atMost(K) - atMost(K-1) |
| 995 | Min K Bit Flips | 🔴 Hard | Greedy flip 0s, track with queue/diff |
| 1007 | Min Domino Rotations | 🟡 Medium | Check tops[0] & bottoms[0] as targets |
| 1200 | Minimum Absolute Difference | 🟢 Easy | Sort + Single Pass to find min diff |
| 1292 | Max Side Length with Sum <= Threshold | 🟡 Medium | Prefix Sums + Binary Search maxLen |
| 1266 | Min Time Visiting All Points | 🟢 Easy | Max(abs(dx), abs(dy)) |
| 1423 | Max Points from Cards | 🟡 Medium | Total - min window of (n-k) |
| 1438 | Longest Subarray With Limit | 🟡 Medium | Monotonic deques for max/min in window |
| 1877 | Minimize Max Pair Sum | 🟡 Medium | Sort, pair smallest with largest |
| 1895 | Largest Magic Square | 🟡 Medium | Prefix sums for rows/cols, check all squares |
| 1937 | Max Points with Cost | 🟡 Medium | DP with left/right pass optimization |
| 1984 | Min Diff Between K Scores | 🟢 Easy | Sort + sliding window of size k |
| 2943 | Maximize Square Hole Area | 🟡 Medium | Sort bars, find max consecutive bars |
| 2975 | Maximum Square Area | 🟡 Medium | All gaps: HashSet(H-gaps) ∩ V-gaps |
| 3047 | Largest Square in Two Rects | 🟡 Medium | Check all N² pairs, intersect is [maxL, minR] |
| 3314 | Construct Min Bitwise Array I | 🟢 Easy | Odd: clear rightmost bit of trailing 1s |
| 3453 | Separate Squares I | 🟡 Medium | Monotonic area → Binary Search on Y |
| 3454 | Separate Squares II | 🔴 Hard | Sweep line (y-events) + Interval merging |
| 3510 | Min Pair Removal to Sort Array II | 🔴 Hard | Heap + LinkedList for min pair sums |
| 3650 | Min Cost Path with Edge Reversals | 🟡 Medium | Add reverse edges (2×), run Dijkstra |
| 3651 | Min Cost Path with Teleportations | 🔴 Hard | 1D DP + Suffix Min, k teleport layers |
Every problem follows a standardized explanation format:
- Problem in Simple Words - Easy to understand problem statement
- Brute Force Approach - With analysis of why it's suboptimal
- Intuitive/Greedy Approach - Examples where it works and fails
- Optimal Solution - With visualization and step-by-step walkthrough
- Complexity Analysis - Time & Space for all approaches
- Key Takeaways - Pattern recognition & what to remember
Interactive step-by-step algorithm visualization - Reads directly from your LeetCode folder!
LeetCode/ ← Your solutions (Question.md, Explanation.md, .java)
↓ API reads from
VisualizerBackend/ ← Express server (localhost:3001)
↓ Serves to
Visualizer/ ← React frontend (localhost:5173)
No duplicate content - Add questions to LeetCode folder, visualizer auto-detects them!
| Feature | Description |
|---|---|
| 🔗 Auto-Sync | Reads Question.md, Explanation.md, and Java code from LeetCode folder |
| 🎬 Step Animation | Navigate through algorithm execution step-by-step |
| 📊 Array Visualization | Sliding window, pointers, deques |
| ✏️ Monaco Editor | Full code editor with syntax highlighting |
| ⌨️ Keyboard Shortcuts | ← Prev |
# Terminal 1: Backend
cd VisualizerBackend && npm install && npm run dev
# Terminal 2: Frontend
cd Visualizer && npm install && npm run devThen open http://localhost:5173/
- Frontend: React 18 + Vite + Tailwind CSS 4 + Monaco Editor
- Backend: Express.js (reads LeetCode folder)
- Pattern Detection: Auto-detects sliding-window, two-pointer, etc.
Master Object-Oriented Programming with practical examples in 3 languages
The LLD section covers core OOP concepts with hands-on code examples:
| Chapter | Topic | Description |
|---|---|---|
| c0 | Introduction | What is OOP? History, Why Abstraction matters |
| c1 | Access Modifiers | public, private, protected, package-private |
| c2 | Constructors | Default, Parameterized, Copy Constructors |
| c3 | Inheritance | extends, super, IS-A relationship |
| c4 | Polymorphism | Method Overloading & Overriding |
| c5 | Interfaces | Contracts, Multiple Inheritance |
| c6 | Abstract Classes | Partial Implementation, When to use |
| c7 | Composition | HAS-A relationship, Aggregation vs Composition |
┌─────────────────────────┐
│ ABSTRACTION │
│ (The Principle) │
│ "Hide complexity, │
│ show essentials" │
└───────────┬─────────────┘
│
┌───────────────────┼───────────────────┐
│ │ │
▼ ▼ ▼
┌───────────────┐ ┌───────────────┐ ┌───────────────┐
│ ENCAPSULATION │ │ INHERITANCE │ │ POLYMORPHISM │
│ (Pillar 1) │ │ (Pillar 2) │ │ (Pillar 3) │
└───────────────┘ └───────────────┘ └───────────────┘
| Language | Path | Status |
|---|---|---|
| ☕ Java | LLD/ | ✅ Complete |
| 🟨 JavaScript (Node.js) | LLD NodeJs/ | ✅ Complete |
| 🐍 Python | LLD Python/ | ✅ Complete |
Each language implementation covers the same concepts with language-specific nuances and best practices.
| Chapter | Topic | Description |
|---|---|---|
| c1 | Introduction | Processes, Threads, Parallelism vs Concurrency |
| c2 | Threads in Java | Thread creation, Lifecycle, Runnable interface |
| c3 | Executors | Thread pools, ExecutorService, Types of executors |
| c4 | Callables | Callable interface, Future, Exception handling |
| c5 | Synchronization Problem | Race conditions, Critical sections |
| c6 | Mutex Locks | ReentrantLock, Lock interface, tryLock |
| c7 | Synchronized Keyword | Method & block synchronization, Intrinsic locks |
| c8 | Atomic Datatypes | AtomicInteger, AtomicReference, CAS operations |
| c9 | Volatile Keyword | Memory visibility, Happens-before |
| c10 | Concurrent Collections | ConcurrentHashMap, CopyOnWriteArrayList |
| c11 | Semaphores | Counting semaphores, Resource limiting |
| c12 | Producer Consumer | BlockingQueue, Wait-notify pattern |
| c13 | Deadlocks | Detection, Prevention, Resource ordering |
| c14 | Wait Notify | Object.wait(), notify(), notifyAll() |
| Chapter | Topic | Description |
|---|---|---|
| c1 | Generics | Type parameters, Bounded types, Wildcards |
| c2 | Lambdas | Functional interfaces, Lambda syntax, Method references |
| c3 | Streams | Stream API, Operations, Collectors, Parallel streams |
| c4 | Collection Framework | Collection hierarchy, Common interfaces |
| c5 | List Interface | ArrayList, LinkedList, Vector, Stack |
| c6 | Set Interface | HashSet, LinkedHashSet, TreeSet |
| c7 | Queue Interface | PriorityQueue, Deque, ArrayDeque |
| c8 | Map Interface | HashMap, LinkedHashMap, TreeMap |
| c9 | Iterators | Iterator, ListIterator, fail-fast vs fail-safe |
| c10 | Custom Objects | equals(), hashCode(), Comparable, Comparator |
System Design concepts, patterns, and case studies
-
System Design Fundamentals
- Scalability, Reliability, Availability
- CAP Theorem
- Load Balancing
- Caching Strategies
-
Design Patterns
- Singleton, Factory, Builder
- Observer, Strategy, Decorator
-
System Design Case Studies
- URL Shortener
- Rate Limiter
- Notification System
- Chat Application
Curated collection of articles, books, blogs, and videos
Books
To be added...
Articles & Blogs
To be added...
Video Resources
To be added...
Useful Links
To be added...
# For Java projects
Java 17+ (recommended: Java 21)
Maven 3.8+
# For Node.js projects
Node.js 18+
# For Python projects
Python 3.10+cd LeetCode
mvn compile
mvn exec:java -Dexec.mainClass="org.example.Main"cd LLD
mvn compile
mvn exec:java -Dexec.mainClass="org.example.p1_oops.c0_introduction.Main"cd "LLD NodeJs"
node p1_oops/c0_introduction/Main.jscd "LLD Python"
python p1_oops/c0_introduction/main.pyNotes/
├── 📂 LeetCode/ # LeetCode solutions (Java)
│ └── src/main/java/org/example/
│ ├── Q0001_TwoSum/
│ │ ├── TwoSum.java # Solution
│ │ ├── Question.md # Problem statement
│ │ └── Explanation.md # Detailed explanation
│ └── ...
│
├── 📂 VisualizerBackend/ # Backend API (reads LeetCode folder)
│ └── server.js # Express server
│
├── 📂 Visualizer/ # Frontend (React)
│ └── src/
│ ├── components/ # UI components
│ ├── engine/ # Algorithm execution
│ └── hooks/ # React hooks
│
├── 📂 LLD/ # Low-Level Design (Java)
├── 📂 LLD NodeJs/ # Low-Level Design (JavaScript)
├── 📂 LLD Python/ # Low-Level Design (Python)
│
└── 📄 README.md # You are here!
This is a personal learning repository. If you find any issues or have suggestions:
- Feel free to open an issue
- Suggestions for new problems/topics are welcome
- Found a bug in an explanation? Let me know!
- Easy: 7 solved
- Medium: 22 solved
- Hard: 9 solved
- Total: 38 problems
- OOP Fundamentals (8 chapters)
- Concurrency (14 chapters)
- Java Advanced Concepts (10 chapters: Generics, Lambdas, Streams, Collections)
- Design Patterns (Coming Soon)
- SOLID Principles (Coming Soon)
- System Design Basics (Coming Soon)
- Case Studies (Coming Soon)
⭐ Star this repo if you find it helpful! ⭐
Made with 💻 and ☕