Tip 64

LeetCode is supposed to be fun!

by Ildar Akhmetov

Leetcode is a great collection of programming puzzles. The problems are fun to solve, and it's a nice way to flex your brain. The problems are well curated, the tests are extensive, and there is a huge community to practice and learn together.

But. Leetcode is considered the Big Gatekeeper, and it's the biggest source of anxiety. "I must learn N LeetCode problems by heart, then I can get a job" -- that's what I hear very often. And N is usually in the range of 100 to 1000.

It sounds obvious, but I will still say it. Please, do not try to memorize solutions. It is a dead end. You may pass a shallow technical interview with a memorized solution, but it will not get you anywhere beyond that.

It's actually better if you do not have the most efficient solution, but can think out loud and speak about the trade-offs as you solve the problem live. Well, it may even be okay if you don't solve the problem at all -- if it's clear that you're solving it, not trying to reproduce the next line of that "best O(1) solution".

Try treating Leetcode problems as they naturally are -- fun puzzles. What is the easiest brute force solution? What can be optimized? Which algorithms come to mind when you see it? Would X work? What if we tried Y? How about Z?

If you minimize the anxiety ("I must remember them all") and keep the fun ("I have this really silly algorithm in mind... but hey, let me try!"), you might enjoy the process.

I know, it's much easier said than done, and anxiety catches us in many ways (waking up at 3am, anyone?). But if solving problems is not fun at all, then... why?

Related Tips

Get tips in your inbox

Two new tips every week.

Powered by Buttondown