r/leetcode • • 21h ago

Question How long does it take to master DSA?

I started grinding Leetcode seriously 2 weeks ago. I subscribed to Leetcode premium and also bought a crash course for more structured learning. However, it seemed like it took me forever just to pick up how to solve the simplest "String and Array" problems 😂 I think the course does help me to understand the basic concepts like two pointers, sliding window etc. But to really master and apply the same concept to different questions is quite difficult. It's been two weeks and I am still stuck at solving string and array problems, I feel like a joke. For all the experienced and smart people here, can you please point me to the right direction? Tell me how to master DSA quickly? Because I am afraid I am not fast enough to learn everything before my upcoming interview.

80 Upvotes

39 comments sorted by

39

u/jyscao 19h ago

Depends on what level you consider mastering to be.

Being good enough to pass say at least half of the coding interviews given out there? Maybe 6mo to 2 years depending on your existing level and aptitude for picking up the DSA patterns.

Being a legitimately impressive CP problem solver? Much longer, and you'll probably be working towards it for the rest of your life.

1

u/Additional_Reveal822 19h ago

I see. Random question, do you think AI will change the technical test landscape? Do you think Leetcode style style is still a golden standard for tech interview in the next 6-12months?

7

u/jyscao 19h ago

do you think AI will change the technical test landscape?

It already has. Some companies are now giving out "AI Coding" interviews to candidates. Recently had to undergo one of these myself.

Do you think Leetcode style style is still a golden standard for tech interview in the next 6-12months?

I don't think so. It's becoming more of a screening type interview, rather than something that's used to definitively judge junior candidates' technical abilities.

It sounds to me like you're mainly interested in getting good at DSA for the sake of technical interviews. In that case, I'd advise you to not overthink it, continue working at improving in this regard, but don't psych yourself out over it by thinking you're not good enough yet, and must reach a certain level before applying to jobs and doing their technical interviews. Rather start applying asap, while you're still learning and improving, and just roll with the punches so to speak. Because their are also soft-skill aspects to these technical interviews, especially like knowing how to communicate your thought process during it, that you can only really practice and get good at when you actually do some real interviews.

3

u/Additional_Reveal822 19h ago

Thanks for the encouragement. I used to grind Leetcode many years back when I was looking for a job, but then I completely forget all the basic concepts because I didn't really use them in day to day work. And recently I started to look into it seriously and realized the way I am learning Leetcode might not be the more efficient and curious how's others learn.

1

u/GaimeGuy 8h ago

The issue is you learn quite quickly in the non academic world that no one cares about doing things the right way or the optimal way. Managers visibly recoil when they hear 50% of the SLOC in a PR is refactoring. So you end up focusing on the product instead of the blueprints. The thread diagrams get outdated, the help document on the test environment haven't been touched in 4 years, etc.

We screen workers for skills they are forced to subsequently atrophy. Makes no sense

2

u/tehfrod 19h ago

What was the nature of the "AI coding" interview?

Not asking you to break nda, just the general shape of it

2

u/jyscao 18h ago

I actually made a Reddit thread on this about 2 weeks ago, which you can checkout here.

My experience turned out to be fairly similar to what people described in that thread.

14

u/tehfrod 20h ago edited 20h ago

To truly master it you would have to spend at least a few years working at a PhD level or industry equivalent, and not just playing leetcode.

To get good enough to pass a FAANG interview, assuming you already had the basics in a uni course, probably six months if you're just doing leetcode, less if you are actually studying it with intent from good source materials.

I failed my first FAANG interview, studied hard for about three or four months using good quality books and lectures, and made it on the second try.

4

u/Additional_Reveal822 20h ago

Can you share what are the good source materials? And you mentioned 3-4 months of studying hard, how many hours you spent everyday?

11

u/tehfrod 20h ago • Heartwarming

This is the lecture series I used (although a older version): https://www3.cs.stonybrook.edu/~skiena/373/videos/

This is the book: https://www.thriftbooks.com/w/introduction-to-algorithms_clifford-stein_thomas-h-cormen/254823/item/10058586

Although I would recommend this instead: https://www.betterworldbooks.com/product/detail/algorithms-9780321573513

I had a 45 to 60 minute commute, so I ripped that audio and listened to the lectures each way (which sucked when he got to graph theory—"So we can see that this vertex is connected to...? [inaudible] right. So that means...")

A couple of nights a week plus some weekends went into reviewing the videos of the lectures and the book, and trying to hand implement what I had heard or read.

Good luck!

2

u/Additional_Reveal822 20h ago

These are really good stuff, thanks for being kind and share your learning generously 😉

1

u/ComprehensiveRate953 14h ago

Did you have basics at uni? Surprised you went to books rather than straight for Leetcode and picking up things as you go along.

2

u/tehfrod 14h ago

Yeah. I find that going straight to leetcode and "picking it up as you go" gets you a much shallower understanding.

Like, you might know that an algorithm like quicksort works, but you may not really understand why or how, which means you probably won't know about the one case in which it falls on its face—and if you don't know that, then you won't be able to invent something like Timsort.

5

u/Comfortable_Put6016 21h ago

my approach is do 2-3 exercises that teach a specific algo or data structure / are supposed to be solved with a specific algo or data structure and thats it

i then go around and search for different problems and try to reduce them towards these algos / datastructures ; but i suppose its based on intuition and problem decomposition

i suppose the last part the decomposition plays the most part aka breaking down a problem and tryting to make sense of behavior in data / restrictions/ intended goal and work around from there

dsa works more like a toolkit to reduce towards rather than memoization of sprecific solutions for specific problems

2

u/Additional_Reveal822 20h ago

Thanks for sharing, how long do you take to master everything?

3

u/Comfortable_Put6016 20h ago

what do you mean by mastering; either you understand and algorithm/data structure or you do not

applying it in code just comes by well writing codes. do projects. dont use llm code gen

1

u/Additional_Reveal822 20h ago

Mastering means able to understand and solve algorithm and data structure problem confidently without help from looking at solution and ask AI for help

3

u/tehfrod 20h ago

I disagree that it's a binary "you know it or you don't", because the algorithms field continues to evolve year by year, and there are almost certainly more algorithms than you know.

2

u/Comfortable_Put6016 20h ago

noone will pull out insane niche algos for interviews

1

u/tehfrod 20h ago

I had an interview in which I found out the best algorithm to use (and what they were looking for) was one I hadn't heard of.

When I looked it up, that's because while it had been invented in the 70s, it was a little-used niche algorithm until the last 10 years or so, so I had never run into it in academics or in industry.

1

u/Comfortable_Put6016 19h ago

there is no "the beat algorithm"

1

u/tehfrod 19h ago

Sorry "best algorithm". Fixed.

1

u/jyscao 19h ago

out of curiosity, what was the algorithm?

2

u/tehfrod 19h ago

Bloom filter

1

u/jyscao 18h ago

Nice, it's a cool concept that I understand in theory, but never implemented. Interesting to hear that some companies actually expect you to know it IRL. Must have been a pretty selective and prestigious corp then, right?

1

u/tehfrod 14h ago

Google.

4

u/Comfortable_Put6016 20h ago

probably you should work on some projects to get more intuition how code works and how to design stuff this should help understanding and decomposition.

4

u/Material-Command-854 20h ago

It can take months. I would try to temper your expectations but not give up. Be patient with the process and yourself.

1

u/Additional_Reveal822 20h ago

Thanks for the encouragement, so nice of you ☺️

3

u/soft_abyss 20h ago

It takes a long time for it to stick long term imo.

1

u/Additional_Reveal822 20h ago

I see, look like I can't just master everything right away.

2

u/maaKaBharosaa stole bananas from koko 20h ago

For me it took around 2.5 years to reach 1800 at leetcode

1

u/Additional_Reveal822 20h ago

Legendary, can you share your secret? What I should do and what I should avoid?

3

u/maaKaBharosaa stole bananas from koko 19h ago • Bravo

Doing cses selected problems worked like charm for me. They have very standard problems that teach you so many important concepts. They are hard, like actually hard, but you will be a different person after doing them. And don't do all of them, do selected only. Maybe I can share a list with you sometime. And do leetcode hards. Learning is there. Don't be afraid of hard problems. Ig that's pretty much it. And yes, have patience

1

u/Additional_Reveal822 19h ago

I genuinely want to learn, will be really grateful of you can share the list of questions later.

1

u/duluoz1 21h ago

You sure you want to be a SWE?

2

u/Additional_Reveal822 20h ago

Not really a SWE, but AI and Data roles in my country required to pass Leetcode style tests. I don't think it's natural to me. I have consulted some people in the industry, I think it's a common problem for AI and Data people

3

u/The-Real-Odysseus 20h ago

what does OPs desire with wanting to be a SWE have to be with how quickly they pick up LC? LC is also standard testing even outside of direct SWE roles?

2

u/Additional_Reveal822 20h ago

Thanks for backing me up 🥹