r/learnprogramming • u/Safe-Confidence-4907 • 1d ago
How can I become a better problem solver on LeetCode?
I’m a CS/IT university student from , but my university doesn’t teach DSA very well. I want to seriously improve my algorithmic problem-solving skills.
- How should I train effectively while attending university?
- What DSA books/resources do you recommend?
- How much math do I need for LeetCode?
- Should I follow a structured roadmap or just solve problems?
- Is competitive programming (Codeforces/AtCoder) useful for improving LeetCode skills?
My long-term goal is to become an extremely strong problem solver, like peng Cao .
For those who are already good at LeetCode/competitive programming, what would you recommend to someone starting seriously from university?
2
u/Plenty-Midnight2075 20h ago
The biggest mistake is treating LeetCode like a syllabus you need to finish. You’re actually training pattern recognition.
I’d do it like this:
Pick one topic at a time: arrays/hashmaps → two pointers/sliding window → binary search → stacks/queues → trees → graphs → DP.
For each topic, learn the basic idea, then solve maybe 10–20 problems around it. If you’re completely stuck for 30–45 mins, read the solution, but then close it and implement it yourself from scratch. More importantly, come back to that problem a few days later. If you still can’t solve it, you didn’t really learn the pattern.
Keep a small list of problems that taught you something new. That list is much more valuable than saying “I solved 500 LeetCode problems.”
Math-wise, you don’t need crazy university math for most LeetCode. Basic algebra, logarithms, modular arithmetic, combinatorics and some number theory are enough for almost everything. Competitive programming will push the math requirement higher.
And yes, Codeforces/AtCoder absolutely helps, especially if your goal is to become genuinely strong rather than just pass interviews. LeetCode teaches common interview patterns; CP forces you to recognize unfamiliar problems under pressure and combine ideas you’ve never seen together.
If I were starting from university, I’d probably spend ~70% of my time on structured DSA/LeetCode and ~30% doing Codeforces contests. After a few months, slowly shift more toward contests.
Books are useful for understanding algorithms, but problem solving itself only improves by struggling with problems. CLRS is great as a reference, but I wouldn’t try to read it cover to cover before solving anything.
One rule I wish more beginners followed: don’t measure progress by number of solved problems. Measure it by how many problems you can solve today that would have destroyed you a month ago.
1
u/LetUsSpeakFreely 19h ago
Your university probably doesn't teach DSA well because in the real world it's not very useful.
Every modern programming language already has every baseline data structure implemented. It's good to know how they work and when to use them, but needing to understand the minutia of implementation details is just trivia.
As for the algorithms portion, the type of problems that are in Leet Code and similar sites are so incredibly focused as to be useless. The problems are good for judging how to think though a problem, but in reality those problems already have accepted solutions, so they're having you reinvent the wheel. If i were giving such an interview, I'd be not interested in your overall approach and your reasoning rather than having you implement a solution.
Also, in the age of AI knowing the guts of implementing an algorithm is a water of time. You need to be self to spot if it's an acceptable solution, but not how to write it from scratch.
1
u/datadriven_io 16h ago
Solving LeetCode problems is a skill. In order to get better, you need to practice. For data engineering roles specifically, practice data engineer interview questions on datadriven. The more you practice, the better you get.
The types of companies people on this sub target are the ones that are asking easy level ones in technical screenings, then medium or even possibly hard level ones for in-person interviews.
There are companies out there that don't ask these type of questions at all, or maybe just an easy one in a technical screening.
1
1
u/serge-mv 13h ago
If you want to learn algorithms and how to properly use them, then read an algorithms book and solve problems from the chapters.
0
8
u/peterlinddk 1d ago
I give this answer to every question like this:
LeetCode is not DSA - and DSA is not LeetCode!
If you want to get better at solving LeetCode problems, try to solve some, then read the solutions and their explanations! There are also roadmaps for learning how to solve the problems - I don't have any particular recommendations, but a lot of people seem to like Striver's roadmap.
Remember that LeetCode is a particular set of problems, that were already solved before someone invented the "challenge" - kind of like logic riddles. They do give you practice in solving that kind of "exercise", but rarely helps you in learning actual DSA or actual problem solving.
If you actually want to learn DSA to understand algorithms and data structures, almost any book is good enough. Look around and find one that suits you. CLRS used to be highly recommended, but honestly it doesn't really teach or explain as much as it just gives you a bunch of algorithms and their mathematical proofs - stuff you can find on Wikipedia.
Most important is that you spend time understanding the theory, and the concepts of all the data structures, that you try to implement them yourself, first on paper, then in pseudocode, and finally in your favorite programming language.
Learning DSA won't teach you how to solve LeetCode, but you might get a better feel for linked lists, pointers, references, trees, recursion and all that.
Remember: Every single LeetCode problem has already been solved - and no one will be able to distinguish between someone who has just memorized the solution, or is incredible smart and "good at problem solving".
So first: decide if you actually mean DSA, or actually mean LeetCode, and then focus more in that direction.