dsa patterns 2

πŸ“… 23 Jul 2025

View on Github β†—

date: 2025-07-23 topics: [dsa, algorithms, patterns, logic] day: 6

πŸ“˜ Day 6 – More Core DSA Patterns & Problem Solving

βœ… What I Worked On

  • Solved & revised 7 more fundamental DSA problems
  • Focused on how logic works under the hood, not just syntax
  • Applied pattern recognition to reduce brute-force thinking

πŸ“š What I Learned

ProblemPattern / Concept
Sum of DigitsUse % 10 to extract digits, / 10 to reduce number
FactorialLoop-based multiplication
Merge 2 Sorted ArraysTwo-pointer technique
Count FrequencyUse HashMap to map element β†’ count
Missing NumberUse sum of n formula or XOR logic
Remove DuplicatesUse Set to eliminate repeats
Max Subarray SumKadane’s Algorithm (dynamic programming)

Kadane’s Algorithm stood out β€” it feels magical how a greedy local sum helps track global max subarray!

❌ Blockers

  • Remembering the XOR trick for missing number required extra practice
  • Off-by-one mistakes in two-pointer merges

🧠 Reflection

DSA is starting to feel intuitive now. I’m seeing how many problems reuse similar ideas: pointers, hash maps, or math. Understanding the underlying patterns is 100x more effective than memorizing solutions.

πŸ”— References / Code