Videos
I've been trying to grind Leetcode. But almost everytime I get stuck or the solutions I come up with are brute Force algorithms with awful runtimes. Then I look at the solutions and convince myself that I understood the problem all while knowing full well that I didn't learn Jack shit. And with this comes the feeling of dread.
If this describes your situation too, then I highly encourage reading books like Cracking the coding interview. The solutions are explained extremely well, it gives solid outlines on how to approach the problem and how to use the right data structures at the right times. It feels like I'm actually learning something and is preparing me better for tackling Leetcode later on.
Hope this helps anyone going through the same frustration with Leetcode.
I used to think that way too. I used to be in a rush to do LeetCode since I had interviews coming up and was very busy with school. I decided to try and prepare better since I am graduating in May 2021. I started doing at least 5 Leetcode problems a day since June. I try to do 10 on weekends. I know these numbers sound high, but I really don't want to fuck up again so I'm doing everything I can to get better.
Since I have much more time to prepare and don't feel rushed, I try to take my time solving the problems and looking at solutions. What I found is that the biggest skill you develop with Leetcode is problem solving. I see a lot of people on Reddit say that LeetCode only tests your data structures and algorithms knowledge, which is 100% false. In fact, knowing DS&A is the easy part of LeetCode. Once you know how they are implemented and their runtimes, you know DS&A. The difficulty of LeetCode is applying data structures to problems and solving them. Having a good explanation for solutions is very important, but understanding solutions is not what matters. What actually matters is practicing problem solving. I used to give up quite quickly on problems and then just try to understand solutions, which is a terrible approach. While I did remember a lot of solutions, I couldn't solve new problems for shit.
Once I really started practicing trying to solve problems I became a lot better at Leetcode. Understanding solutions is only one part of the equation, you first need to solve problems.
*Edit: I just wanted to add on to what I said about LeetCode not testing your DS&A knowledge whatsoever. Before starting LeetCode and even knowing it existed, I had already done the DS&A course and was a TA for that course. I knew all the runtime complexities, knew how to implement all of them and knew advanced algorithms (probabilistic, meta-heuristics and approximative algorithms). It's fair to say that I knew very well all the theory for DS&A. However, I struggled on LeetCode easy problems when I first started and was really bad at solving them. Even if I knew DS&A very well, it didn't help me at all to outperform my colleagues who knew basic theory but had practiced LeetCode for a while. The real difficulty of LeetCode is not understanding that a HashSet performs searches in O(1). The difficulty is understanding when this data structure could be useful and what repeated computations could be stored in a Set for a given problem.
The reason I am writing this is because everytime someone on Reddit says that he is struggling with LeetCode, many people just comment to learn more about DS&A. I'm frankly tired of seeing that shitty advice. People who struggle at LeetCode don't struggle because they don't know what a stack is, they struggle because they didn't develop the problem solving skills and haven't seen problems solved usings stacks. There are plenty of hard problems that are solved by using like 3 stacks in a smart way. That doesn't require extensive DS&A skills to figure out, it requires great problem solving skills.
Agreed with a slight addition-- I think you do need both. You won't get too far if you just sit in front of the problems and try to work with the first solution that comes to you (when I did that my runtime was always really bad and most of the time I was just aimlessly trying to solve them). So you gotta read up on what patterns you should be looking for and specific ways on how to approach the problem. But it's also very easy to just read and be like, mhm okay, this looks good to me but you won't know if you can actually do it yourself or not until you do the problems yourself. I think a good approach (ideally if you still have a few months to prep) is to read one of those chapters and then try to solve some new lc questions on the strategy you just learned-- that's at least what works best for me.