The LeetCode Phenomenon
In the winter of 2015, I was working as a Software Engineer at Microsoft and looking for my next Software Engineering job, albeit with little success. I remember expressing my frustration to a friend over a velvety Stout beer at a funky bar in Seattle’s Ballard neighborhood on a cold, rainy November night. I remember his words clearly:
site-https://www.kitp.ucsb.edu/sites/default/files/filefield_paths/watch-demon-slayer-kimetsu-no-yaiba-the-movie-mugen-train-online.pdf
“So, there is this platform which sort of lets you game the System”
site-https://www.kitp.ucsb.edu/sites/default/files/filefield_paths/watch-All-My-Life-online.pdf
That’s when I first heard about LeetCode- a programming platform which has now become the staple for coding interview preparation. The platform consists of interview style coding questions with an integrated, online IDE which lets you submit and verify the correctness of your solution. It also contains a stack-overflow style discussion forum which lets you post and upvote/downvote solutions to the problems.
site-https://www.kitp.ucsb.edu/sites/default/files/filefield_paths/watch-365-days-online.pdf
Today, if you are interview prepping, you’re going to have to spend some late evenings practicing interview problems on LeetCode. In the words of one of my good friends and colleague:
LeetCode is the great equalizer. Whether you are interviewing for an internship, as a fresh grad just out of college, or as a seasoned Engineering Manager, you’d better be LeetCoding.
site-https://www.kitp.ucsb.edu/sites/default/files/filefield_paths/watch-jiu-jitsu-online.pdf
I crawled home from the bar that November evening and started practicing problems on LeetCode. Over the next few weeks I practiced several dozen problems. Practicing made a huge difference that time and I eventually landed and accepted an offer from Google in 2016.
site-https://www.kitp.ucsb.edu/sites/default/files/filefield_paths/watch-ava-online.pdf
I’d never seen anything like LeetCode before. Platforms I’d been using for interview preparation before LeetCode had been passive — with information flowing in one direction (from the author to me). There was the quintessential interview preparation book “Cracking the Coding Interview”. Then there was CareerCup/Glassdoor which had user generated content that could be perused to find commonly asked interview questions. The main shortcomings of these platforms are:
site-https://www.onlinegdb.com/
They don’t really prepare you for interviews because they diverge from how real-world interviews are conducted
They are less engaging (due to a lack of a community)
It’s harder to internalize concepts/learning due to a lack of reflection. This is because you are offered one (or zero) solution to problems which can typically be solved in many different ways.
site-https://jsfiddle.net/rmca9L8y/
There were several programming platforms like TopCoder that were interactive and had a browser based IDE. However, these were optimized for competitive programming where the problem description itself would span multiple pages and you’d spend half the time trying to figure out the right input/output format rather than building actual algorithms.
site-https://paiza.io/projects/mvYovFQDKzP6B74j3hv31g?language=php
LeetCode recognized a need and built a platform that was interactive, was closer to how interviews were being conducted in the real world and just worked. LeetCode does its job remarkably well- the problem definitions are succinct, the community is thriving and discussion forums have high quality discussions.
site-https://paste.ee/p/cJFDM
Fast forward to mid 2020, and I was interviewing again. The coding interviews seemed a lot different from 2016, not only because we were in the middle of a pandemic (not the focus of this article), but also because how LeetCode had evolved as a platform.
site-https://paste.toolforge.org/view/efcbfe52
LeetCoding was a verb now, and the system which barely had 150 questions in 2016 had over a 1000 questions now, with weekly competitions, gamification (you can earn “LeetCoins” for solving problems) and even something which I’ve named the “cheating mode”, which is a compilation of interview questions that have been reportedly asked by the various companies.
While working at Google, I went through the list of interview questions tagged as “Google” and found several of them on Google’s internal interview question list (Google tries to fight this by “banning” questions that are publicly known to have been asked by Google).
site-https://pasteio.com/xWdOKC1H0TeD
The consequence of the “cheating mode” is that the interview bar ends up being raised — largely because the industry is flooded with self proclaimed “Prolific LeetCoders” who have solved over 1000 questions and are hoping to get interview questions that they’ve already solved before. Here is screenshot from the Blind app (an anonymous forum for Tech Employees), where we have a self proclaimed “Prolific LeetCoder” who has solved 1059 of the 1132 questions available on LeetCode:
site-https://www.hybrid-analysis.com/sample/ce7f84bc02479431bc8f31ca5e5935f7bbb8c41ec38b6c6eeba60fdd171781bb
I did a little thought experiment to see how long it would take me to solve 1059 questions while having a full time job. Based on my experience, it takes approximately 1–1.5 hours to attempt a solution and then look up/research alternative ways to solve the problem. So, solving 1059 questions would take 1059 hours. Assuming that you are trying to prepare while you have a full-time job, and that you dedicate 1.5 hours a day after work to LeetCoding, and never miss a single day, solving 1059 questions will take you a grand total of 1059 days, or approximately 2 years. 2 years?! Ok, WTF.
site-https://groovytastemakertyrant.tumblr.com/
Before we get into what you can do to stay competitive, let me point out that trying to solve every single problem on LeetCode with the hope that you will get a question that you’ve already solved has a few issues:
It’s ethically very dubious. It’s like practicing for a test with leaked questions.
Even looking past the scruples, it just doesn’t scale. You probably just don’t have that kind of time. And even if you did, it’s not the best use of your preparation time.
You’re probably not going to get an interview problem from that list , anyway. This is because what’s tagged is a sub-section of interview questions. And not every company asks LeetCode style questions.
Having practiced or seen an interview question might actually work against you. As the interviewers are becoming aware of the LeetCode Phenomenon, they are likely to tweak the problems to add/remove constraints which might throw you off.
Whether you love or hate LeetCode (or what the platform represents), the LeetCode Phenomenon is rampant and pervasive. A few months ago, when I screwed up the coding phone screen interview at Netflix (where I was asked a classic LeetCoding problem that I hadn’t seen before, and was able to solve, just not quickly enough), the empathetic Hiring Manager asked me to brush up on my LeetCoding and to take another shot at the interview in a month or so.
site-https://groovytastemakertyrant.tumblr.com/post/635266733027016704/full-movie
Companies are taking steps to fight the issue of leaked questions:
Google actively “bans” leaked questions. Internally at Google, there is a widely circulated doc (called “The LeetCode Problem”) which discusses this issue in depth.
site-https://www.peeranswer.com/question/5fb71e50cbf908ce160144a6
Some companies are constantly creating new questions. At Square, for example, interviewers are asked to create their own interview questions (which are then approved by a committee to keep the bar consistent).
site-https://groovytastemakertyrant.tumblr.com/
site-https://groovytastemakertyrant.tumblr.com/post/635266733027016704/full-movie
Then there is a set of companies that don’t ask LeetCode style problems at all (my heroes). Stripe and Shopify have a refreshing approach focused on solving problems that are a more accurate representation of the problems you’d be solving day to day (e.g. sorting a list of items based on a certain constraint). Interviews at Twitter (and certain teams at Netflix) tend to be team specific as well, and usually non LeetCode style. Lyft’s onsite consists of a laptop programming challenge which is open-book and you’re encouraged to use any public library.
site-https://gariko2040.medium.com/the-leetcode-phenomenon-17f893d2a605
All right, now what are you supposed to do to stay competitive with the Prolific LeetCoders? Surely, there is a better way than cramming 1059 problems? I’ll cover that in a follow-up to this article. Follow me to be notified!