Skip to content

Latest commit

Β 

History

History
313 lines (240 loc) Β· 6.51 KB

File metadata and controls

313 lines (240 loc) Β· 6.51 KB

πŸŽ“ Algorithm Study Guide

A structured approach to mastering algorithms and data structures for technical interviews.

πŸ“… Study Schedule

Week 1-2: Foundation Patterns

Focus: Build pattern recognition skills

Days 1-3: Hash Maps & Two Pointers

  • Complete all hash_map.py problems
  • Complete all two_pointers.py problems
  • Practice: LeetCode Easy (5 problems each pattern)

Key Concepts:

  • Hash map for O(1) lookups
  • Two pointers for sorted arrays
  • Fast/slow pointer for cycles

Days 4-7: Sliding Window & Binary Search

  • Complete all sliding_window.py problems
  • Complete all binary_search.py problems
  • Practice: LeetCode Medium (3 problems each)

Key Concepts:

  • Variable vs fixed window
  • Binary search variants
  • Search space reduction

Week 3-4: Tree & Graph Traversals

Focus: Master DFS and BFS

Days 8-10: DFS & Backtracking

  • Complete all dfs_backtracking.py problems
  • Practice: Subsets, permutations, combinations
  • Solve 3 N-Queens variants

Key Concepts:

  • Recursive backtracking
  • Pruning branches
  • State restoration

Days 11-14: BFS & Graphs

  • Complete all bfs.py problems
  • Complete all graphs.py problems
  • Practice: Grid problems, shortest paths

Key Concepts:

  • Level-order traversal
  • Topological sort
  • Union-Find for components

Week 5-6: Dynamic Programming

Focus: Break down optimal substructure

Days 15-21: DP Fundamentals

  • Complete all dynamic_programming.py problems
  • Practice: Fibonacci β†’ Knapsack β†’ LCS
  • Solve 5 medium DP problems

Progression:

  1. 1D DP (Fibonacci, climbing stairs)
  2. 2D DP (Knapsack, LCS)
  3. State optimization (Space reduction)

Week 7-8: Advanced Patterns

Focus: Heaps and advanced techniques

Days 22-28: Heaps & Priority Queues

  • Complete all heaps.py problems
  • Practice: Top-K problems
  • Master median from stream

🎯 Problem Selection Strategy

By Difficulty

  1. Easy (Days 1-7): Build confidence

    • Understand patterns
    • Write clean code
    • Practice explaining solutions
  2. Medium (Days 8-21): Core interview level

    • Combine multiple patterns
    • Optimize solutions
    • Handle edge cases
  3. Hard (Days 22-28): Stretch goals

    • Complex combinations
    • Multiple approaches
    • Time/space tradeoffs

By Company

Target companies have different focuses:

FAANG Focus:

  • Trees & Graphs (30%)
  • Dynamic Programming (25%)
  • Arrays & Strings (20%)
  • System Design (25%)

Startups:

  • Practical coding (40%)
  • Data structures (30%)
  • Algorithms (20%)
  • Debugging (10%)

🧠 Learning Techniques

1. Active Recall

After solving a problem:

  • Close the code
  • Explain approach out loud
  • Rewrite from memory
  • Compare with original

2. Spaced Repetition

Review schedule:

  • Day 1: Solve problem
  • Day 3: Resolve without hints
  • Day 7: Solve similar variant
  • Day 14: Explain to someone else

3. Pattern Recognition Drill

When seeing a new problem:

  1. Identify pattern (30 seconds)
  2. Sketch approach (2 minutes)
  3. Write code (15 minutes)
  4. Test & optimize (5 minutes)

πŸ“Š Progress Tracking

Daily Checklist

[ ] Solve 2-3 problems
[ ] Write tests for solutions
[ ] Review one previous problem
[ ] Explain solution to rubber duck
[ ] Note learnings in journal

Weekly Review

  • Count problems solved by pattern
  • Identify weak areas
  • Adjust study plan
  • Mock interview practice

🎀 Mock Interview Prep

Week 1-4: Solo Practice

  • Solve problems with timer (45 min)
  • Verbalize thought process
  • Write clean, tested code
  • Analyze complexity

Week 5-6: Peer Practice

  • Alternate interviewer/candidate roles
  • Practice communication
  • Receive feedback
  • Simulate real conditions

Week 7-8: Mock Interviews

  • Use platforms: Pramp, interviewing.io
  • Record sessions
  • Review recordings
  • Iterate on weaknesses

πŸ”„ Problem-Solving Framework

Step 1: Understand (2 min)

  • Clarify requirements
  • Ask about edge cases
  • Confirm input/output format
  • Identify constraints

Step 2: Plan (3 min)

  • Identify pattern
  • Discuss brute force
  • Optimize approach
  • Estimate complexity

Step 3: Implement (15 min)

  • Write clean code
  • Use meaningful names
  • Add comments if helpful
  • Think out loud

Step 4: Test (5 min)

  • Walk through example
  • Test edge cases
  • Verify complexity
  • Discuss tradeoffs

πŸ“š Resources by Pattern

Hash Maps

  • Two Sum variations
  • Anagram problems
  • Substring patterns

Two Pointers

  • Sorted array problems
  • Palindrome checks
  • Container problems

Sliding Window

  • Substring problems
  • Maximum/minimum windows
  • Fixed vs variable size

Binary Search

  • Classic search
  • Rotated arrays
  • Search answer space

DFS/Backtracking

  • Generate all subsets
  • Permutations
  • N-Queens variants

BFS

  • Level-order traversal
  • Shortest path problems
  • Grid traversal

Dynamic Programming

  • Fibonacci sequence
  • Knapsack variations
  • String problems (LCS, edit distance)

Graphs

  • DFS/BFS traversal
  • Topological sort
  • Union-Find
  • Shortest paths (Dijkstra, Bellman-Ford)

Heaps

  • Top-K problems
  • Merge K lists
  • Running median

πŸ† Mastery Checklist

You've mastered a pattern when you can:

  • Identify pattern in <30 seconds
  • Explain approach clearly
  • Write bug-free code in one pass
  • Analyze time/space complexity
  • Discuss tradeoffs
  • Optimize solution
  • Handle all edge cases
  • Teach pattern to someone else

πŸ’‘ Tips for Success

  1. Consistency > Intensity: 2 hours daily beats 14 hours on Sunday
  2. Understand, Don't Memorize: Focus on why, not what
  3. Code Without IDE: Practice on paper or whiteboard
  4. Explain Out Loud: Verbalizing reveals gaps
  5. Review Mistakes: Learn more from errors than successes
  6. Take Breaks: Pomodoro technique (25 min work, 5 min break)
  7. Stay Healthy: Sleep, exercise, eat well
  8. Track Progress: Celebrate small wins

🎯 Interview Day Checklist

Day Before

  • Review top 10 patterns
  • Solve 2-3 favorite problems
  • Prepare questions for interviewer
  • Get good sleep (7-8 hours)

Interview Day

  • Light review (no new problems)
  • Warm up with easy problem
  • Stay hydrated
  • Breathe and stay calm
  • Think out loud
  • Ask clarifying questions

After Interview

  • Write down problems attempted
  • Note what went well/poorly
  • Solve any problems you struggled with
  • Iterate for next time

You got this! πŸš€