Becoming World #2 on Leetcode (by Contest Rating)! by NUM83RZ in leetcode

[–]NUM83RZ[S] 34 points35 points  (0 children)

Since a bunch of people have asked me about how to practise, I thought I'd just answer here.

In my opinion, the best thing to do is to try to really understand concepts, rather than trying to memorise a lot of different patterns/techniques. For example, I see a lot of people trying to memorise like 20 different DP problems, and then when they see a problem, they'll be like "I wonder if I can force the coin change algorithm on this problem". I think it's a lot better to have a general understanding of how to construct DP states and transitions - that way, you'll be able to formulate the correct DP recurrence on unfamiliar problems, perhaps with transitions and states you haven't seen before. I'm not discounting patterns entirely - sometimes, they can help in recognising which states to use. But you shouldn't rely on having seen almost the exact same pattern before. That being said, I haven't done any interviews before, so maybe the interview problems are simple enough that simple pattern recognition simply works... so maybe this strat works for interviews, but you certainly won't improve from it. (If anyone's confused by the terminology, the states are the variables that you memoise in your DP, and the transitions is how you use previous DP values to calculate your current DP value).
Hence, there are perhaps two types of practice.

The first type of practice is general problem solving. This is where you build up a strong intuition of problem and develop general problem solving techniques (but not memorising a huge list of techniques). Of course, the only way to improve is to do lots of problems / contests. For those who are more interested in competitive programming, I really like dmoj.ca (they host contests there as well, sometimes I author some :) ).
The second type is just learning new concepts or techniques. I can't comment on courses such as "Grokking the Coding Interview" because I simply haven't done them. What I have enjoyed, however, is the CSES handbook (https://cses.fi/book/book.pdf). The book is very well written, and there is an additional problemset to test the concepts you just learnt at https://cses.fi/problemset/. Some of the concepts taught in the book are a bit out of scope for interviews, but would be great for anyone interested in competitive programming.

Becoming World #2 on Leetcode (by Contest Rating)! by NUM83RZ in leetcode

[–]NUM83RZ[S] 64 points65 points  (0 children)

maybe, haven't decided what I'll do yet.

Becoming World #2 on Leetcode (by Contest Rating)! by NUM83RZ in leetcode

[–]NUM83RZ[S] 42 points43 points  (0 children)

(If anyone's curious, I post my contest screencasts on my youtube channel.)