Notes - The Ultimate Revision Hub 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 1752 Check if Array Is Sorted and Rotated Is array a rotated sorted array? Count break points ≤ 1, check wrap-around 3719 Longest Balanced Subarray I Longest subarray: distinct evens = distinct odds O(n²) diff trick: +1 even, -1 odd, diff==0
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) Binary Search (click to expand) Dynamic Programming (click to expand) Sliding Window (click to expand) Two Pointers (click to expand) Greedy (click to expand) 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 401 Binary Watch All times with k LEDs on Gosper's hack: iterate k-bit subsets of 10 LEDs 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) 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) Matrix & Prefix Sum (click to expand) Design (click to expand) Bit Manipulation (click to expand) # Problem Description Q-Card 190 Reverse Bits Reverse 32-bit integer's bits Loop: extract LSB of n, push into rev via shift+OR 401 Binary Watch All times with k LEDs on Gosper's hack: enumerate all k-bit subsets of 10 bits 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) 67 Add Binary 🟢 Easy Two pointers R→L, carry = t/2, digit = t%2 85 Maximal Rectangle 🔴 Hard Histogram per row + Monotonic Stack 110 Balanced Binary Tree 🟢 Easy Bottom-up DFS, -1 sentinel short-circuit 190 Reverse Bits 🟢 Easy Extract LSB → shift left → OR into rev, 32× 401 Binary Watch 🟢 Easy Gosper's hack: k-bit subsets of 10 LEDs 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 744 Find Smallest Letter Greater Than Target 🟢 Easy Binary search for first letter > target 799 Champagne Tower 🟡 Medium Simulate pour: cap 1.0, overflow 50/50 down 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)) 1382 Balance a Binary Search Tree 🟡 Medium In-order + Divide & Conquer rebuild 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 1752 Check if Array Is Sorted and Rotated 🟢 Easy Count break points ≤ 1, check wrap-around 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 2976 Min Cost to Convert String I 🟡 Medium Floyd-Warshall on 26-node graph 2977 Min Cost to Convert String II 🔴 Hard Trie + Floyd-Warshall + DP 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 3713 Longest Balanced Substring I 🟡 Medium O(n²) uniq==cntMax: all chars at max freq? 3714 Longest Balanced Substring II 🟡 Medium Decompose 3 chars → 7 subsets, diff+HashMap 3719 Longest Balanced Subarray I 🟡 Medium O(n²) diff trick: distinct even-odd balance
Every problem follows a standardized explanation format:
Problem in Simple Words - Easy to understand problem statementBrute Force Approach - With analysis of why it's suboptimalIntuitive/Greedy Approach - Examples where it works and failsOptimal Solution - With visualization and step-by-step walkthroughComplexity Analysis - Time & Space for all approachesKey Takeaways - Pattern recognition & what to rememberInteractive step-by-step algorithm visualization - Reads directly from your LeetCode folder!
Single Source of Truth Architecture 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: Backendcd VisualizerBackend && npm install && npm run dev
# Terminal 2: Frontendcd Visualizer && npm install && npm run devThen open http://localhost:5173/
Frontend : React 18 + Vite + Tailwind CSS 4 + Monaco EditorBackend : 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) │
└───────────────┘ └───────────────┘ └───────────────┘
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
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! ⭐ Star this repo if you find it helpful! ⭐
Made with 💻 and ☕