I'm a first-year computer science student and I just started learning Data Structures and Algorithms (DSA) with Java about 2.5 months ago. In that time, I've tackled over 20 pattern questions (like star and alphabet patterns), more than 30 problems related to arrays, and 13 binary search problems. I revise everything weekly, but I'm really struggling to retain what I've learned. It takes me a long time to solve even the easier problems, sometimes up to an hour and a half for tougher ones. I'm concerned because I'm forgetting the material quickly and feel stuck. Does anyone have advice on how to improve problem-solving skills and better retain the concepts in DSA?
4 Answers
Getting through DSA isn't easy, trust me! Keep grinding those problems, but don’t rely on just memorizing solutions. It’s essential to understand the underlying theory and intuition for the algorithms and data structures. Focus on the 'why' behind each solution. Combining repetition with a solid understanding is key to retention.
It seems like you're mixing up platforms like LeetCode with the fundamentals of DSA. DSA is a standalone subject that involves understanding how to store and manage data effectively, while platforms like LeetCode are just applications of those principles. Make sure to study DSA separately before diving into problem sets.
Can you recommend any good textbooks for learning DSA, since I want to ace interview questions?
Keep at it and don’t spend too much time on each problem (max two hours). Look at the solution briefly if you're stuck, then code it out yourself. Memorizing someone else's code won't help you; realizing the concept and coding it from your understanding is what you need to focus on.
I’m not sure I like the idea of looking at the solutions instantly though. Wouldn't it be better to just get hints instead?
Okay, I’ll keep that in mind. Thanks for the advice!
You're possibly focusing too much on predefined problems without grasping the theory first. Start with learning the concepts, implement them, and then solve problems using those concepts. Repeat that cycle for various structures. After that, tackle more complex problems to apply what you've learned. It's all about understanding first before applying it.
Does step 4 mean I should learn specific algorithms like binary search or two-pointer techniques? I didn't quite get step 5.

Let me try that approach too!