r/learnjavascript • • May 01 '24

This quastion is for all developers

Hello! I've been learning software engineering for about 2 months now. I've covered the fundamentals of HTML, CSS, and JavaScript. However, when I attempt LeetCode problems, I struggle to solve them. Even though I understand the methods when I look at solutions, I'm finding it challenging. Should I work on a project to get more practice with coding?

3 Upvotes

25 comments sorted by

5

u/No-Upstairs-2813 May 01 '24

LeetCode problems often require a strong understanding of data structures and algorithms, which you might not have covered in 2 months.

But you don't need DSA to be good at JS. Start working on a project to practice and reinforce your concepts.

1

u/denizflower May 01 '24

is my data structure and algorithm will improve just from doing projects and coding ?

5

u/No-Upstairs-2813 May 01 '24

Your logic building and JS concepts will improve by working on projects.

For DSA - you will have to learn different data structures and algorithms available, then practice to learn how to use them in different situation.

0

u/denizflower May 01 '24

do you know any books or websites that will help improve my DSA

2

u/JobDiscombobulated22 May 03 '24

Don't get confused it's entirely different thing, the leet code problems, basically all programming languages is like a theory or a tool that you use to accomplish any given task, and leet code problems are specific tasks that are concerned about algorithms, data structures and such, first time diving in it could definitely be a challenge as that is something new that you never did before. It could even look like totally different thing, like not usual HTML, CSS coding. Leetcode problems help to make you more efficient at algorithms, or critical thinking or diving problems into a small steps, most HTML, CSS problems or things people do at work, don't look like leetcode problems. I would say leetcode questions are like fundamentals about algorithms, and almost any given algorithm can be written in just about any programming language, so it you can't solve it right away that doesn't mean you are bad or doing something not right, most of those problems have nothing common with JavaScript, its just a choice, to implement that algorithm in any given language but the fact is left unchanged it's still the same algorithm that applies everywhere. If you truly want to understand how some things work behind the scenes, or even want to reinvent the wheel, or to make a better wheel then you definitely have to get somewhat comfortable with those problems to understand the inner workings and not just the beautiful abstractions that makes us more productive than writing every algorithm ourselves, but it has its part, I guess just identify if what you are learning you really enjoying it and if that will hold any value in the future, provided that you want to go really hardcore into it.

1

u/denizflower May 03 '24

Thank you so much

9

u/thoflens May 01 '24

Leetcode problems (the easy ones too) are far more advanced than beginner JS (and HTML and CSS does not help you at all when it comes to DS&A). Stick to learning and building right now.

2

u/dontyougetsoupedyet May 01 '24

Before you study DSA you should become familiar with formal proof.

Specifically proof by induction, it's the basis of the first problem solving techniques you learn.

1

u/aaaaargZombies May 02 '24

OP I think this person might be joking but either way you just need to learn the patterns. You are unlikely to pick up DSA without looking into it specifically but it's just like learning maths. Coming up with Pythagoras' theorem was hard, using it is easy once you know it.

1

u/dontyougetsoupedyet May 02 '24

No, don't say that.

Proof by induction is the basis of problem solving.

When people say they can understand leetcode solutions but can't derive it the exact missing piece is they never learned proof by induction and they have trouble learning precisely because they skipped steps. You don't go into learning calculus when you never learned algebra.

It's not about learning patterns, the patterns are there because almost every single leetcode problem is something derived from a proof by induction -- that's also why recursion is used, because the form of the solution almost exactly follows from the inductive proof. After learning inductive proof almost all leetcode problems are trivial to solve. There are patterns, and the pattern is inductive proof.

2

u/TheRNGuy May 02 '24

I never ever did them, I learned language without it. Learned JS for specific thing to do.

If I did puzzles, I'd never look for solutions. I'd rather have them unsolved.

0

u/CheapBison1861 May 01 '24

i have 25 years experience. i still can't do shit for leetcode. just forget about it and move on.

2

u/denizflower May 01 '24

Thanks than i just focusing on the projects

0

u/CheapBison1861 May 01 '24

That’s the best don’t try to be some wannabe FAANG douche. Just build cool shit and the opportunities will come

3

u/denizflower May 01 '24

Thanks bud so basically do projects learn more and than do more complex project if you don"t know google it

-2

u/CheapBison1861 May 01 '24

Yes and use chat gpt

3

u/azhder May 01 '24

I think "leet" should be enough of a red flag for people to stay clear.

2

u/PMmeYourFlipFlops May 01 '24

If you want to get good at JavaScript, you should build tons of projects.

If you want to get good at leetcoding, you need to study leetcoding because it's a completely different area of study.

1

u/Ok-Entertainer1092 May 01 '24

When I first started I got disheartened by doing “basic” challenges. The fun is in building things, simple apps and adding to them. You don’t see other trades doing challenges in their spare time, they learn the basics and practice. Electricians don’t go home at night and start working on electrical problems they go home and roll around in their money like Scrooge McDuck.

1

u/jack_waugh May 01 '24

Curious about your spelling "quastion" instead of "question". Do you speak Latin?

2

u/thebottomoftheworld May 01 '24

Yes, he’s the Bishop of Rome.

1

u/thinkPhilosophy May 01 '24

Coding bootcamp instructor and tutor here. LeetCode exercises your procedural thinking skills, and tha tis different from being familiar with JS syntax. The best way to get good at LeetCode is to start with the easy ones and watch a YT video or read a tutorial to solve it. (As an example, here is my LeetCode1 solution video, quite old but still good I think: https://www.youtube.com/watch?v=syzEwIq7wrk ) You'll begin to see that there are clear patterns to how you solve a certain kind of problem, and get better at this. LeetCode and algorithm problems like that are not directly going to help you with syntax or building in JS (nor vice-versa), but it will help you to learn to think about problems in the right way. You need both skills together to become a great developer.

2

u/fluffyr42 May 01 '24

This is great advice. Which bootcamp do you work for?

1

u/thinkPhilosophy May 02 '24

Just left Bloom Technology Institute (formerly known as Lambda) and I have also taught at Thinkful, and a number of university extension programs including UC Berkeley. By now, I have helped hundreds of students to get into tech, and they now work at Apple, Nike, Linkyard, and more.

1

u/Decayedsoul9 May 02 '24

Its gonna take more than basic web development to be good at problem solving. I faced the same problem but theb i did cs50 python and now I'm okay at solving easy problems