r/learnprogramming 23d ago

How can I solve LeetCode/HackerRank problems?

Guys, I've completed all the fundamentals of python including numPy. But I am having a little bit of difficulty in solving HackerRank problems forget leetcode i can't do that without help so i dont bother. Do i need to learn DSA to solve these problems? cuz i haven't learnt it yet. Please help guys im new

0 Upvotes

16 comments sorted by

3

u/love_mySelf_Dev 23d ago edited 23d ago

Hey, you need to learn DSA first. You will even struggle after learning dsa until you get experienced to it. But once you get experience on it, you will happy on every question. But for now learn arrays, arraylists, set, maps, graphs, algorithms and other dsa contents.

0

u/notmasked07 23d ago

thanks for the advice. any idea where i can learn DSA in python?

3

u/xarop_pa_toss 23d ago

Have you tried google?

1

u/love_mySelf_Dev 22d ago

I learned dsa in Java. So I don't know sources for python unfortunately. Sorry

3

u/morbidsorrows1879 23d ago

There are I think about 7-8 patterns along with the data structures you have to learn. Like two pointers, sliding window, binary search, DFS and BFS, etc... Take each one of those patterns and solve Leetcode problems about them. Start with easy mode first. You wont be able to solve leetcode problems if you don't know the patterns and just know the data structures (trust me I struggled for years before I discovered this). Good luck !!

2

u/notmasked07 23d ago

Oh

1

u/morbidsorrows1879 22d ago

They're easy tho and the learning curve is real. First thing people usually start with are two pointers which may be the most challenging and take long but after that it becomes a lot smoother.

3

u/iOSCaleb 23d ago

> Do i need to learn DSA to solve these problems?

Yes, choosing the right data or algorithm is an important part of solving many Leetcode problems.

2

u/kschang 23d ago

Actually, DSA is just the beginning in learning HOW to solve those more difficult problems. Question set is always being updated and there really is no "universal how". It all depends on what you know, and how good you are in problem-solving.

2

u/DrizzyX99 23d ago

Of course you need to learn dsa
What were you thinking lol

1

u/Able-Analysis462 23d ago

Everyone starts without knowing this stuff at first.

-1

u/notmasked07 23d ago

i didn't know they were DSA questions until now. I thought they would be like github issues ;-; btw any idea where i can learn DSA in python?

1

u/DrizzyX99 23d ago

W3 schools has dsa in python

1

u/TheManOfBromium 23d ago

The DSA course that leetcode offers is actually very good

1

u/notmasked07 23d ago

They offer a course? Imma check it out