Day 3 of DSA Journey: Strings & Pattern Matching

🚀 Day 3 of My DSA Journey Today was all about Strings & Pattern Matching 🔍 Here’s what I learned: ✅ Anagram Logic Using frequency arrays to compare strings efficiently Learned why c - 'a' is used (index mapping) ✅ String Compression Difference between frequency-based vs consecutive compression Understood why using StringBuilder is important (avoids O(n²)) ✅ KMP Algorithm (Game Changer!) Learned how to search patterns in O(n + m) time Key idea: Don’t restart, jump using LPS Understood LPS (Longest Prefix = Suffix) with step-by-step dry run 💡 Biggest takeaway: 👉 Writing code is easy, but understanding why it's optimal is what really matters. ⚡ From brute force → optimized thinking That shift is the real progress. #DSA #100DaysOfCode #Java #ProblemSolving #LearningJourney #Coding

To view or add a comment, sign in

Explore content categories