Dashboard
Your Progress
Track mastery across all DSA patterns
📬
0
Due for Review
📖
0
Currently Learning
0
Mastered
🔥
0 days
Study Streak
📈 Category Mastery
📬 Due for Review
📅 Study Activity (Last 6 Months)
Less
More
☀️ Daily Challenge
Pattern Library
30 patterns with Java templates, visualizations & complexity
Flashcard Review
SM-2 spaced repetition · Space = reveal · 1-4 = rate
Card 1 / 1
⌨ Space = reveal · 1 Again · 2 Hard · 3 Good · 4 Easy
💾
🎯 When to Use
    ⚙️ How to Use
      Java Template
      How well did you know this?
      🎉
      Session Complete!
      You reviewed 0 cards. Keep it up!

      Pattern Recognition Quiz

      Question 1 of 50  |  Current Streak: 0
      Medium LC 1
      Problem Title
      Problem description goes here...

      12-Week DSA Roadmap

      Track your progress from beginner to interview-ready.
      Overall Progress 0%

      Achievements

      Unlock achievements by studying, reviewing flashcards, and acing quizzes.
      0 / 25 Unlocked

      🧠 How to Think Through DSA Problems

      A battle-tested framework for recognising patterns, drilling down on any problem, and coding clean Java solutions under pressure.

      01
      🔍 Decode the Problem ~2 min

      Before writing a single line, make sure you truly understand what's being asked.

      • Restate the problem in your own words out loud.
      • Identify: What is the input? What is the exact output?
      • Ask about constraints: array size, value range, can there be negatives? duplicates? null?
      • Walk through the provided examples manually — don't trust that you understand without doing this.
      • Create 1-2 of your own examples, including an edge case (empty input, single element, all same values).
      💡 Most interview bugs come from misreading the problem. Spend the time here.
      02
      🎯 Identify the Pattern ~3 min

      Map what you see in the problem to a known algorithm pattern. Ask yourself these questions in order:

      • Is the input sorted? → Binary Search or Two Pointers
      • Contiguous subarray/substring with a condition? → Sliding Window
      • Count/sum subarrays? → Prefix Sum + HashMap
      • Shortest path, minimum steps, level-by-level? → BFS
      • Connected components, cycle detection, all paths? → DFS / Union-Find
      • Dependencies between tasks? → Topological Sort
      • Optimal sub-problem overlapping? → Dynamic Programming
      • All combinations, permutations, or subsets? → Backtracking
      • K largest/smallest elements? → Heap (Priority Queue)
      • Next greater/smaller to the left/right? → Monotonic Stack
      • Prefix of words, autocomplete? → Trie
      • Weighted shortest path? → Dijkstra (no negative) / Bellman-Ford (negative ok)
      💡 If no pattern clicks immediately, think about the brute force — then ask what makes it slow and how to fix that.
      03
      🗣️ Verbalize the Algorithm ~5 min

      Before opening an IDE, state your approach in plain English, step by step.

      • Say "I'll use [pattern] because [reason]."
      • Describe the data structures you need and why (e.g. "I need a HashMap to track char frequencies in O(1)").
      • Walk through your algorithm on the example input — trace it mentally or on paper.
      • State your time and space complexity. Is it good enough? What are the constraints?
      • Only proceed to coding once you can trace through the algorithm correctly on paper.
      ⚠️ Do not code until you can verbalize. Coding before thinking leads to spaghetti you have to rewrite anyway.
      04
      ⌨️ Code it in Java ~15 min

      Write clean, readable code. Follow this Java-specific checklist:

      • Handle edge cases first: if (nums == null || nums.length == 0) return ...;
      • Use descriptive variable names: left, right, windowSum, maxLen — not i, j, x, y.
      • Prefer int mid = left + (right - left) / 2; over (left + right) / 2 to avoid integer overflow.
      • For DFS/BFS: always mark visited before enqueueing, not after dequeuing.
      • For DP: always think "do I need 1D or 2D? Can I roll it into 1D?"
      • Think about what to return when the answer doesn't exist (e.g., -1 vs empty list vs 0).
      💡 Write comments for non-obvious steps. It helps the interviewer follow along AND helps you catch bugs.
      05
      🧪 Test Edge Cases ~5 min

      Never say "I think it works." Systematically test these cases:

      • Empty input: [], "", null
      • Single element: [5]
      • All same values: [1,1,1,1]
      • Already sorted / reverse sorted
      • Negative numbers / zeros
      • Maximum input size (does it TLE?)
      • The provided examples (run through your code step by step)
      ⚠️ A solution that passes all examples but fails edge cases is the #1 reason for coding round rejections.
      The Drill-Down Checklist

      When you're stuck, run through this checklist in order:

      1. What is the brute force? How slow is it? (O(n²)? O(2ⁿ)?)
      2. What is the bottleneck — what computation is repeated?
      3. Can you use a data structure to make repeated lookups O(1)? → HashMap, Set, Heap
      4. Can you precompute something? → Prefix Sum, Sorted Array
      5. Can you solve a simpler subproblem and build up? → DP
      6. Can you discard half the search space? → Binary Search
      7. Can you process things in a specific order? → Greedy, Topological Sort
      Read these until you can do this mapping in under 5 seconds. This is pattern recognition — the core skill.
      📢
      What to SAY in a Coding Interview

      Interviewers grade communication as much as correctness. Use this script:

      1. "Let me restate the problem:" — repeat it back to confirm understanding.
      2. "My initial edge cases are:" — null check, empty input, single element.
      3. "My first thought is brute force — that would be O(?) because..."
      4. "I notice [observation] — this suggests [pattern] because..."
      5. "My approach will be: [algorithm steps in English]."
      6. "The time complexity is O(?) because... and space is O(?) because..."
      7. "Let me code this up. I'll start with the edge case check."
      8. While coding: narrate what each block does: "This loop slides the window..."
      9. After coding: "Let me trace through the first example..."
      10. At the end: "I'd also test: empty input, single element, all negatives."
      🚨
      Common Java Bugs to Avoid
      • Integer overflow: use long when summing large arrays. int mid = left + (right-left)/2 not (left+right)/2.
      • Off-by-one in binary search: think "does this need left=0, right=n or right=n-1?" Match your loop invariant to your return.
      • Null checks in trees: always handle if (node == null) return; as your first line in DFS.
      • ConcurrentModificationException: never modify a collection while iterating it. Use an iterator or collect into a separate list.
      • Stack overflow in DFS: for very deep recursion (n > 10,000), convert to iterative with an explicit Stack.
      • HashMap default value: use map.getOrDefault(key, 0) not map.get(key) (which returns null for missing keys).
      • PriorityQueue ordering: Java's PriorityQueue is a min-heap by default. For max-heap: new PriorityQueue<>(Collections.reverseOrder()).
      • char to int: 'a' - 'a' = 0, so use c - 'a' to get 0-25 index for letter arrays.
      ⏱️
      Time Management in Interviews

      For a 45-minute interview with one coding problem:

      • 0-5 min: Understand, ask clarifying questions, write examples.
      • 5-10 min: Identify pattern, state brute force, optimize.
      • 10-30 min: Code the solution cleanly.
      • 30-38 min: Test with examples + edge cases. Fix bugs.
      • 38-45 min: Discuss time/space complexity, potential improvements.
      ⚠️ If stuck after 10 minutes of thinking, ask for a hint. It's better than sitting silent. Interviewers appreciate self-awareness.
      🧩
      How to Handle Unseen Problems

      You WILL see problems you haven't seen before. That's the point. Here's how to handle them:

      1. Don't panic. Every novel problem is a combination of known patterns.
      2. Identify the data structures involved (array? tree? graph? string?).
      3. Think about what operation is being repeated — that repetition is your bottleneck.
      4. Ask: "If the input were tiny (n=3), how would I solve it by hand?"
      5. Ask: "What information do I need at each step that I'm currently recomputing?"
      6. Write the brute force first. Often the interviewer will accept O(n²) with the right intuition explained.
      7. Optimize step by step: can a HashMap help? Can I sort first? Can I use a sliding window?

      🗓️ Your 20-Day DSA God Run

      You have 20 days of pure focus. This is the exact sequence to go from decent to dangerous.

      🏗️ High-Level System Design (HLD)

      The 7-step RSCALED framework for designing scalable, resilient distributed systems.

      The 7-Step RSCALED Framework: Requirements (R) → Scale Estimates (S) → Core APIs (C) → Architecture (A) → Low-Level Deep Dive (L) → Edge Cases (E) → Database Choice (D)

      🔷 Low-Level Object-Oriented Design (LLD)

      Object-oriented design patterns, thread safety, and clean Java class hierarchies.

      5-Step OOD Blueprint: Clarify Use Cases → Identify Core Classes → Define Relationships (is-a vs has-a) → Apply Design Patterns (Strategy, Observer, State, Factory) → Implement Clean Thread-Safe Java Code

      📝 Mistake Log

      Track every mistake, tag the pattern, and review them daily. This is your most powerful learning tool.

      + Log a New Mistake