Burn Rate

Chill On The Leetcode

I’m a habitual browser of /r/csMajors and /r/cscareerquestions. I’m not really sure why. I’m not looking for advice and honestly I find a lot of the posts unrealistic, bordering on actively discouraging. For instance, when a person asks about getting a job, the answer provided is inevitably for them to “grind Leetcode”.

Leetcode, for those of you who don’t know, is a site where users can practice technical interview problems. You can take your pick of interview questions and solve it with your language of choice. These questions are usually some sort of programming challenge involving data structures and algorithms—kind of the programming equivalent of a brainteaser.

This advice isn’t without merit; for better or worse technical interview problems are the standard way of screening candidates. Not knowing how to solve these questions can hurt your job opportunities while getting good at these questions can help you get a job without a strong resume.

But what a lot of people are missing when they blindly advise to “grind Leetcode” is that, well…Leetcode is boring as shit.

I know when I’ve tried to practice Leetcode, I get bored within minutes and sneak a peek at the answer. This isn’t because the questions are too easy mind you. The times that I’ve tried Leetcode, I’ve left discouraged and worried about my impending interviews.

Yet I’ve done alright in interviews. I’ve gotten offers from prestigious companies. What’s up with that?

Nobody’s Perfect

I’ve come out of quite a few technical interviews confident I messed up. I took way too long to figure out the solution, or I didn’t even find the solution. I had a lot of bugs in my code. I couldn’t figure out improvements easily. Only…to get the job. Why is that?

No Sane Person Expects Perfection

What’s lost in the Leetcode grind is that a sane interviewer doesn’t expect you to solve the problem immediately. The entire point of the technical interview is to see how you think. If you were to solve the question immediately, it wouldn’t help them. All it’d tell them is that you’ve seen the question before. You’re meant to struggle with the questions so that the interviewer can see how you problem solve.

You do need some base level of knowledge. If you don’t know about hashtables, you probably won’t do very well with most questions.

But, you protest, I could just pretend to not know the question and come up with the answer. Sure, you could. It’d take some pretty convincing acting skills and a fairly trusting interviewer but you could. It’s up to you how much deceit you want in your application process.

Communication

Okay, but even if the point isn’t to see every question, Leetcode still helps with gaining the necessary problem solving skills, no?

Yes and no. Leetcode certainly gets you better at solving interview questions. It doesn’t help you get better at communicating this process.

Technical interviews aren’t just the interviewer telling you the problem, you thinking really hard, and then you giving a solution. Maybe if you’re Richard Feynman. Technical interviews are a dialogue between you and the interviewer. Sitting at a desk and neurotically solving questions on Leetcode won’t help you convey your thought process to your interviewer.

Again I’m not some problem solving phenom. However I am a decent technical communicator. I know how to write a not terrible proof and I can bang out an essay or two without too much trouble. When I’m explaining a solution, I describe why I’ve chosen this solution (often it was the first one that popped into my head), how I’m implementing it, what potential problems it can have, etc. Even if I’m way off track, the interviewer should have a good idea of what’s in my head and can use that to steer me in the right direction.

Listing potential problems is a really good skill by the way. I learned it by way of math. The art of proofwriting consists of composing an argument, then attacking it as viciously as possible. Writing good code is the same. You should be constantly thinking of potential problems with your code, whether that be space constraints, possible errors, edgecases, or even—when at scale—gamma rays from space coming and flipping bits on your hard drive.

If you’re set on practicing interview questions, I’d recommend doing mock interviews with a friend. Ideally on an actual whiteboard or a Google Doc. They should know the solution(s) to the question and be able to provide hints, just like an actual interview.

Sometimes You Lose

Another response I’ve gotten to my anti-Leetcode stance is something along the lines of “well I got a Leetcode hard problem and they expected me to solve it completely”.

And sorry, that sucks. But that’s not the majority of experiences. Otherwise Google’s hiring rate would be close to zero. In that situation, you got unlucky. You got the hardass who decided that everybody needs to be tourist. Try again next time.

So yes, you could spend your days practicing Leetcode, training for that unfortunate situation where you get a hardass interviewer. For me, I want to live my damn life.

What Instead?

If I had to give recommendations on preparing for interviews, I’d recommend learning how to solve problems and communicate these solutions. A good way to learn these skills is to study math, specifically proofs. Math is equal parts coming up with a solution and convincing other people that your solution is correct. Some particular areas you should explore are discrete math and abstract algebra. Both are connected to CS and will help you with reasoning about data structures.

Programming also helps. People claim that real world programming isn’t related to interview questions whatsoever. I’d say it’s about 80-90% not related. But if you program a lot, you’ll start to pick up common tricks like using a hash table when you need fast lookup, or keeping data pre-sorted. Plus programming uses your problem solving skills, while working with others uses your communication skills. Two for one!

Practicing with a partner, as mentioned before, is a good option.

You Can Do It!

I wrote this post because I’d feel so discouraged before interviews because I never “grind Leetcode”. And yet it’s what everybody seems to recommend online.

Imagine if you went on every fitness subreddit and the only advice people would give if you wanted to lose weight was to “run a few miles every day”. That’s it. Nothing about picking up a sport, nothing about watching your diet, just running a few miles each day. If you didn’t like running, you’d probably get discouraged, because clearly that’s the only way to lose weight.

The same is true with Leetcode. There’s nothing wrong with doing Leetcode to get a job. But it’s not the only way to get a tech job. You can practice in many different ways and still pass a technical interview.

This project is maintained by torchNYU