Skip to content

Latest commit

 

History

History
328 lines (242 loc) · 10.2 KB

DSA_Practice_Roadmap.md

File metadata and controls

328 lines (242 loc) · 10.2 KB

🗺️ DSA Practice Roadmap - Pattern-Based Learning

A structured 10-week program to master coding interview patterns

📅 Week-by-Week Breakdown

Week 1: Two Pointers

Build on your moveZeros knowledge!

Core Concept: Use two indices to traverse data structures efficiently

Must-Do Problems:

  1. Two Sum II (LeetCode 167) - Easy ⭐
  2. 3Sum (LeetCode 15) - Medium ⭐⭐⭐
  3. Container With Most Water (LeetCode 11) - Medium ⭐⭐⭐
  4. Trapping Rain Water (LeetCode 42) - Hard ⭐⭐⭐⭐⭐
  5. Valid Palindrome (LeetCode 125) - Easy ⭐

Practice Problems:

  • Remove Duplicates from Sorted Array (LeetCode 26)
  • Squares of Sorted Array (LeetCode 977)
  • 4Sum (LeetCode 18)

Key Insights:

  • Always consider if array is sorted
  • Look for "pair" or "triplet" problems
  • Optimize from O(n²) to O(n)

Week 2: Hash Maps & Sets

Master the lookup pattern

Core Concept: O(1) lookups for frequency counting and complement finding

Must-Do Problems:

  1. Two Sum (LeetCode 1) - Easy ⭐⭐⭐
  2. Group Anagrams (LeetCode 49) - Medium ⭐⭐⭐
  3. Top K Frequent Elements (LeetCode 347) - Medium ⭐⭐⭐
  4. Longest Consecutive Sequence (LeetCode 128) - Medium ⭐⭐⭐⭐
  5. Contains Duplicate (LeetCode 217) - Easy ⭐

Practice Problems:

  • Valid Anagram (LeetCode 242)
  • First Unique Character (LeetCode 387)
  • Intersection of Two Arrays (LeetCode 349)

Week 3: Sliding Window

Master the subarray/substring pattern

Core Concept: Maintain a window that slides over data to find optimal solutions

Must-Do Problems:

  1. Best Time to Buy/Sell Stock (LeetCode 121) - Easy ⭐⭐⭐
  2. Longest Substring Without Repeating (LeetCode 3) - Medium ⭐⭐⭐⭐⭐
  3. Minimum Window Substring (LeetCode 76) - Hard ⭐⭐⭐⭐⭐
  4. Sliding Window Maximum (LeetCode 239) - Hard ⭐⭐⭐⭐
  5. Max Consecutive Ones III (LeetCode 1004) - Medium ⭐⭐⭐

Practice Problems:

  • Maximum Average Subarray (LeetCode 643)
  • Permutation in String (LeetCode 567)
  • Longest Repeating Character Replacement (LeetCode 424)

Week 4: Binary Search

Master the search space reduction

Core Concept: Reduce search space by half in each iteration

Must-Do Problems:

  1. Binary Search (LeetCode 704) - Easy ⭐
  2. Search in Rotated Sorted Array (LeetCode 33) - Medium ⭐⭐⭐⭐
  3. Find First/Last Position (LeetCode 34) - Medium ⭐⭐⭐
  4. Search 2D Matrix (LeetCode 74) - Medium ⭐⭐
  5. Koko Eating Bananas (LeetCode 875) - Medium ⭐⭐⭐

Practice Problems:

  • Sqrt(x) (LeetCode 69)
  • Peak Index in Mountain Array (LeetCode 852)
  • Time Based Key-Value Store (LeetCode 981)

Week 5: Fast & Slow Pointers

Master the cycle detection pattern

Core Concept: Two pointers moving at different speeds to detect patterns

Must-Do Problems:

  1. Linked List Cycle (LeetCode 141) - Easy ⭐⭐⭐
  2. Linked List Cycle II (LeetCode 142) - Medium ⭐⭐⭐⭐
  3. Middle of Linked List (LeetCode 876) - Easy ⭐⭐
  4. Happy Number (LeetCode 202) - Easy ⭐⭐
  5. Find Duplicate Number (LeetCode 287) - Medium ⭐⭐⭐⭐

Practice Problems:

  • Remove Nth Node From End (LeetCode 19)
  • Palindrome Linked List (LeetCode 234)
  • Intersection of Two Linked Lists (LeetCode 160)

Week 6: Stack & Queue

Master the LIFO/FIFO patterns

Core Concept: Use stacks for nesting/matching, queues for level processing

Must-Do Problems:

  1. Valid Parentheses (LeetCode 20) - Easy ⭐⭐⭐
  2. Min Stack (LeetCode 155) - Medium ⭐⭐⭐
  3. Daily Temperatures (LeetCode 739) - Medium ⭐⭐⭐⭐
  4. Largest Rectangle in Histogram (LeetCode 84) - Hard ⭐⭐⭐⭐⭐
  5. Evaluate Reverse Polish Notation (LeetCode 150) - Medium ⭐⭐

Practice Problems:

  • Implement Queue using Stacks (LeetCode 232)
  • Next Greater Element (LeetCode 496)
  • Basic Calculator (LeetCode 224)

Week 7: Tree Traversals (DFS/BFS)

Master tree and graph fundamentals

Core Concept: Systematic exploration of tree/graph structures

Must-Do Problems:

  1. Maximum Depth of Binary Tree (LeetCode 104) - Easy ⭐⭐
  2. Same Tree (LeetCode 100) - Easy ⭐⭐
  3. Invert Binary Tree (LeetCode 226) - Easy ⭐⭐⭐
  4. Binary Tree Level Order (LeetCode 102) - Medium ⭐⭐⭐⭐
  5. Validate BST (LeetCode 98) - Medium ⭐⭐⭐⭐

Practice Problems:

  • Symmetric Tree (LeetCode 101)
  • Path Sum (LeetCode 112)
  • Binary Tree Right Side View (LeetCode 199)

Week 8: Graph Algorithms

Master graph traversal and connectivity

Core Concept: Apply DFS/BFS to solve graph problems

Must-Do Problems:

  1. Number of Islands (LeetCode 200) - Medium ⭐⭐⭐⭐⭐
  2. Clone Graph (LeetCode 133) - Medium ⭐⭐⭐
  3. Course Schedule (LeetCode 207) - Medium ⭐⭐⭐⭐
  4. Pacific Atlantic Water Flow (LeetCode 417) - Medium ⭐⭐⭐⭐
  5. Word Ladder (LeetCode 127) - Hard ⭐⭐⭐⭐

Practice Problems:

  • Surrounded Regions (LeetCode 130)
  • Rotting Oranges (LeetCode 994)
  • Network Delay Time (LeetCode 743)

Week 9: Dynamic Programming (1D)

Master the optimization pattern

Core Concept: Break problems into overlapping subproblems

Must-Do Problems:

  1. Climbing Stairs (LeetCode 70) - Easy ⭐⭐
  2. House Robber (LeetCode 198) - Medium ⭐⭐⭐⭐
  3. Coin Change (LeetCode 322) - Medium ⭐⭐⭐⭐⭐
  4. Longest Increasing Subsequence (LeetCode 300) - Medium ⭐⭐⭐⭐
  5. Word Break (LeetCode 139) - Medium ⭐⭐⭐⭐

Practice Problems:

  • Maximum Subarray (LeetCode 53)
  • Decode Ways (LeetCode 91)
  • Jump Game (LeetCode 55)

Week 10: Advanced Patterns

Master specialized patterns

Core Concept: Combine multiple patterns for complex problems

Must-Do Problems:

  1. Merge Intervals (LeetCode 56) - Medium ⭐⭐⭐⭐
  2. Insert Interval (LeetCode 57) - Medium ⭐⭐⭐
  3. Meeting Rooms II (LeetCode 253) - Medium ⭐⭐⭐⭐
  4. Kth Largest in Array (LeetCode 215) - Medium ⭐⭐⭐
  5. Top K Frequent Words (LeetCode 692) - Medium ⭐⭐⭐

Practice Problems:

  • Non-overlapping Intervals (LeetCode 435)
  • Find Median from Data Stream (LeetCode 295)
  • Alien Dictionary (LeetCode 269)

🎯 Daily Practice Schedule

Monday/Wednesday/Friday: New Pattern Introduction

  • 10 min: Read pattern theory
  • 20 min: Watch tutorial/explanation
  • 45 min: Solve 1-2 easy problems
  • 15 min: Review solutions, note patterns

Tuesday/Thursday: Pattern Reinforcement

  • 15 min: Quick pattern review
  • 60 min: Solve 2-3 medium problems
  • 15 min: Analyze time/space complexity

Saturday: Challenge Day

  • 90 min: Attempt 1-2 hard problems
  • 30 min: Study editorial solutions
  • No time pressure - focus on learning

Sunday: Review & Mock Interview

  • 30 min: Review week's patterns
  • 45 min: Mock interview (random problems)
  • 15 min: Identify weak areas

📊 Progress Tracking

Weekly Goals:

  • Week 1-2: 80% easy, 20% medium
  • Week 3-6: 60% medium, 40% easy
  • Week 7-10: 70% medium, 30% hard

Success Metrics:

  • Pattern Recognition: Identify correct pattern in 2-3 minutes
  • Implementation: Code solution in 15-25 minutes
  • Bug-Free: First submission acceptance rate > 70%
  • Optimization: Achieve optimal complexity

Tracking Sheet (Create in your preferred tool):

| Problem | Pattern | Difficulty | Time Taken | Attempts | Date | Notes |
|---------|---------|------------|------------|----------|------|--------|
| Two Sum | HashMap | Easy | 8 min | 1 | 2024-01-01 | Easy win |

🚨 When You Get Stuck

Level 1: Hint Yourself

  • What pattern does this remind me of?
  • What's the brute force approach?
  • Can I optimize the time/space complexity?

Level 2: Partial Solution

  • Look at the problem tags (but not solution)
  • Read the first paragraph of editorial
  • Watch first 5 minutes of explanation video

Level 3: Full Solution Study

  • Study complete solution
  • Understand every line
  • Code it from memory next day
  • Mark for review in 1 week

🏆 Milestone Rewards

  • Week 2: Complete Basic Patterns Badge 🥉
  • Week 5: Intermediate Problem Solver 🥈
  • Week 8: Advanced Algorithm Master 🥇
  • Week 10: Interview Ready Certification 🏆

📚 Recommended Resources

Primary:

  • LeetCode: Pattern-based problem lists
  • NeetCode: Video explanations + roadmap
  • AlgoExpert: Comprehensive video course

Secondary:

  • Grokking the Coding Interview: Pattern-focused book
  • Elements of Programming Interviews: Deep problem analysis
  • Cracking the Coding Interview: Interview context

Practice Platforms:

  • LeetCode: Best for pattern recognition
  • HackerRank: Good for contest practice
  • CodeSignal: Company-specific practice
  • Pramp: Mock interviews with peers

🎯 Company-Specific Final Prep

Google (Weeks 11-12):

  • Focus on: Binary Search, DFS/BFS, DP
  • Practice: Complex algorithm design
  • Mock: 2-3 rounds, 45 min each

Meta (Weeks 11-12):

  • Focus on: Graph algorithms, System design integration
  • Practice: Social network problems
  • Mock: Behavioral + 2 technical rounds

Amazon (Weeks 11-12):

  • Focus on: Two pointers, Heap, Real-world scenarios
  • Practice: Leadership principles integration
  • Mock: Bar raiser round simulation

🚀 Final Success Tips

  1. Consistency > Intensity: 1-2 hours daily beats 8-hour weekends
  2. Understand, Don't Memorize: Focus on pattern recognition
  3. Code by Hand: Practice without IDE occasionally
  4. Explain Out Loud: Teach problems to solidify understanding
  5. Track Progress: Maintain detailed logs of your journey
  6. Stay Positive: Coding interviews are learnable skills!

Start with Week 1 (Two Pointers) since you already have a foundation with your moveZeros problem. You're already ahead of the game! 🎯

Remember: This roadmap is flexible. Adjust based on your pace and comfort level. The key is consistent progress, not perfect adherence to the timeline.