Hello everyone! π
Today marks Day 3 of my 150 Days of DSA Challenge. I decided to dive into string problems, and honestly, they were tricky but super interesting! Strings always look simple but can test your patience with edge cases.
Here are the problems I worked on today:
πΉ [3] Longest Substring Without Repeating Characters
Idea: Use a sliding window + last seen index of characters.
Learning: Hashing/index tricks help reduce time from O(NΒ²) β O(N).
πΉ [5] Longest Palindromic Substring
Idea: Expand around center (each char / pair as a middle).
Learning: Elegant O(NΒ²) solution; DP works too, but expand-around-center feels intuitive.
πΉ [125] Valid Palindrome
Idea: Use two pointers from both ends, ignore non-alphanumeric chars.
Learning: Careful with character checks, but itβs straightforward.
πΉ [49] Group Anagrams
Idea: Sort each string β use as a key β group together.
Learning: Sorting + hashing go hand in hand!
πΉ [242] Valid Anagram
Idea: Count characters and compare.
Learning: Simple but builds foundation for harder problems.
π‘ Reflection:
Today taught me how powerful two pointers, hashing, and string manipulation are. Even though these problems look different, they all circle back to basic concepts like sliding windows, frequency maps, and expansions.
Iβm really enjoying documenting this journey because it makes me accountable, and I know after 150 days, looking back at these posts will feel amazing.
π Tomorrow, Iβll move forward with more string problems / maybe a mix of hash-based challenges.
If youβre also solving these, let me know how you approached them β would love to learn from your strategies! π
Top comments (0)