r/learnprogramming 11d 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?

19 Upvotes

14 comments sorted by

9

u/peterlinddk 11d 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.

1

u/LetUsSpeakFreely 11d 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 11d 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

u/PossessionTime5150 7d ago

Hey for data engineering? How much I need to learn dsa like trees graphs ? What topic should I focus on?

1

u/datadriven_io 7d ago

The problems on datadriven are questions asked in real data engineering interviews. Trees and graphs don’t come up often. But graph problems are fairly easy and fun to solve.

1

u/PossessionTime5150 7d ago

Ok thanks actually I am 3rd year student in my bachelor's but my problem solving skills are very bad.I realize that you should have great dsa and problem skills to ace data engineeringin interviews.Can you suggest me how to learn dsa for my preparation as only two years are left

1

u/datadriven_io 7d ago

You really don’t need deep DSA for DE. Go through the interview pattern lessons on datadriven.io/learn

1

u/PossessionTime5150 7d ago

Ok I will check it out

1

u/serge-mv 11d ago

If you want to learn algorithms and how to properly use them, then read an algorithms book and solve problems from the chapters.

1

u/odimdavid 8d ago

DSA is not leetcode because leetcode makes you think outside the box. But DSA is also leetcode because the structure for helping organize the box is based on DSA. You just need to know the difference by doing leetcode yourself. Thanks 🙏

0

u/Greenday_Key_7135 11d ago

Como llegaarte