Leetcode: common patterns

Natarajan Santhosh
2 min readSep 16, 2023

--

Grinding leetcode is inefficient. What you should be doing is familiarizing yourself with the common patterns you might expect to see in an interview. Look at the blind 75 and https://seanprashad.com/leetcode-patterns/.

Initially, you don’t need to solve any of the problems from scratch. Look up the problem on YouTube and someone will walk you through it. This will build your intuition of when to reach for a heap or for a DP array or when to do BFS, etc. If you don’t know these, then watch another video explaining the concepts. These videos are often 10–15 minutes so with a 30 minute time commitment a day you potentially can get through 3 a day, getting you through the complete blind 75 (more than enough) in less than a month or 1 of each of SP’s 22 patterns in a couple of weeks.

The great thing is you don’t need dedicated time for this approach, you can often start a video while tackling laundry or doing some dishes.

Then, start putting these into practice but spend no more than 10–15 minutes on the problem. If you can’t solve it, go watch the video again. There are so many times where you can have the right approach but make a stupid mistake that will cause you to flounder and you can pick up a better way of doing it. Eventually you will be solving these in 10–15 minutes and the time commitment will have remained at a minimum.

After this, find a new job that is only 40 hours a week and voila you’ve just opened up 10–20 hours for personal projects.

Do not try and do the problems from scratch. All you will end up doing is frustrating yourself for hours and taking far longer to get through the material than you need to. You wouldn’t do this in any other field e.g you wouldn’t jump into a Linear Algebra textbook with no prior experience and expect to be able to solve all of the problems without first reading the chapters. Don’t expect to be able to do that with coding interview patterns either. I’d recommend NeetCode but there’s also Algomonster as well.

https://neetcode.io/

https://algo.monster/

--

--

No responses yet