An Education in Leetcode

A few years ago, when I was searching for a job as a data scientist, I was contacted by a recruiter from a Well Known Tech Company. He said he had seen my LinkedIn profile and thought I would be a good fit for the machine learning engineer position at the company. We talked about the role and the technical requirements, and the work seemed interesting enough. What remained unremarked upon both by me and, of course, by him was the wider public image of the company, an image that depicted it as more interested in advertising and market share than in ensuring that the already vulnerable populations in the world were not made more so by its products.

Instead what we discussed in detail was the interview process. The recruiter explained to me that the first step in the process was a coding test, and that to prepare I should spend some weeks practicing "Leetcode questions." If you have never heard of Leetcode, here is a prototypical question

[Leetcode]

This problem and many others can be found at https://leetcode.com/problemset/all/. Each problem on the site is a programming challenge at a particular difficulty level, and users can earn points and higher rankings by solving the more difficult problems. Here is one of those harder ones:

[Leetcode]

Generally, the problems require the user to write an algorithm that achieves a result and satisfies certain test conditions. They are always devoid of any context that justifies them, and thus the focus is insular, entirely defined by the prompt that is given, one might imagine, by some disembodied supervisor. The harder problems often require tricks that might take a while to find on your own, but, if found, could then be applied to many other similar “hard” problems thus rendering them much easier. This is to say, like performance on most tests, performance on these questions can be improved through practice.

Thus the recruiter told me I should prepare for the interview by going through many rounds of such practice. The Well Known Tech Company had provided lots of material to prepare for this first interview. There was a document reviewing some of the major background topics in data structures and sorting algorithms. I could schedule a practice coding session. I could even schedule a session to watch someone else complete a coding interview.

So, I dutifully began my prep. Because I had come to data science from physics, I was ignorant of the formal aspects of coding. I wanted to learn these topics carefully, but I was at most a month away from the interview. I could work through an online Data Structures and Algorithms course, but this would take more time than I had. Alternatively, I could spend two hours every night working through Leetcode questions. From reviewing interview prep forums, it seemed that the latter was the generally recommended approach. But faced with these two options, one of which was a more careful study that could have value beyond such interviews, and the other a more direct preparation for the interview, my mind seemed more interested in understanding the nature of the choice itself.

What would it mean if I spent the next three weeks using all my after-work hours to prepare for this interview? What would it mean if I chose the superficial preparation of rushing through programming challenges with one-time tricks over a slower process of learning the topics more methodically? What would it mean if I got a job for which the first bar of the interview process required me to cram programming questions of such limited scope that successful solutions could be used to rank anonymous people on a forum?

These questions brought me back to questions I had asked about my own former education in physics. The insularity of the questions, their integration into the first step of a long process at the end of which was acceptance into a prestigious institution, and the seeming hours of preparation required to make it through the first steps of that process. They were all reminiscent of the structure of examinations in physics. Given that similarity, it was clear that the aspects of the interview process that were seemingly external to the subject matter were nevertheless fundamental, arguably even more so than the content. Namely, one’s willingness to jump through these hoops to even get an opportunity to have the position was an important unstated test of the coding interview

In essence, you could know nothing about the precise content of the questions and just think about the steps and structure of preparation for the interview, and then you would understand your likely role in the organization, or understand what the organization expects from you. You need to be analytically quick and dedicated and be willing to give hours of your life to be part of something seemingly larger than you which is actually quite small in its existential ambitions.

<><><>

Leetcode and all of its sister sites compile coding challenges in the space of data structures and algorithms. People who want recreational practice in these problems use these sites to improve their skills, but these sites have also become a source of questions for coding interviews.

The most compelling argument I have heard for the need to use programming questions like these in interviews is that, unlike civil or mechanical engineering, software engineering has no generally accepted standard of certification. Thus, if you are a company that wants employees who can write code, you need some way to evaluate candidates’ ability to do so. You may be disinclined to believe that the coders’ past projects are indicative of future performance since who knows if they coded all the projects they claimed to. So you give these potential employees a programming test, and you use how the candidates construct and discuss their solutions as a rough measure of their proficiency at both coding in particular and problem-solving in general.

This is the stated purpose of Leetcode when used in interviews: Performance on the site’s graded challenges is a proxy for coding ability in a domain where other proxies like degrees and certificates are not wholly trusted. Of course, the “coding ability” that is evaluated is of a narrow problem-solving kind where the primary action of value is analyzing well-defined problems supplied by invisible authority figures. And of course, most candidates and employers acknowledge that Leetcode misses more holistic skills like software architecture, problem finding, and definition. But I would say the content of these coding tests is largely beside the point.

Employers could create a collection of tests that approach more holistically the question of what is a good software engineer, but, if Goodhart’s law is to be believed, performance on any such test could be improved through “grinding” through collections of similar questions, and then these tests would ultimately be evaluating the extent of the previous grind rather than what they originally aimed to probe. One could suppose that all this practice is beneficial to the candidate and that after all of it, she has become a better coder by some definition with at least tangential overlap with the skills required of the job, but what is more certain is that the individual has spent a lot of time training herself to pass through a hoop created by an institution.

Therefore, employers, when selecting for the high performers on these tests are actually selecting for the people who have devoted large parts of their free time to preparing for these tests.

In this way, the test is more of a values filter than a proficiency one. The larger tech companies, companies whose business interests intersect at best ambiguously with the public interest, need a workforce who will largely uncritically accept and implement the orders of their hierarchical superiors. A reliable way to select for such a workforce is to first require any candidate you consider to take a test that itself requires such extensive preparation that anyone who does well is likely to have spent many after-work hours working through practice questions rather than doing things more deeply valuable to their skillset or more aligned with their interests.

And in truth, this is really what a certain type of employer wants. The latent purpose of these tests is that they provide a clear signal of extensive prior preparation which is indicative, not merely of ability or intelligence, but of devotion, a devotion that amounts to a willingness to accept an external reference point of skill and to take on the ideological neutrality of a tool.

If you need workers to build something whose societal implications impinge on issues like algorithmic fairness, economic exploitation, and the further remuneration of an already wealthy elite, then it is truly a benefit (arguably even a requirement) that your workforce not concern itself with the larger meaning of what they are doing. You need them to do the specific job of building the components of the product without being distracted by the social or cultural consequences of the work they do. Selecting for high Leetcode performance selects for such people, people who will devote time and energy to excel according to the myopic standards of their employers while ignoring—or, recognizing but being indifferent to—the wider impact of their work.

In other words, you need employees who have a tendency to be ideologically subservient to their employers, or who believe in the ideological neutrality of their work, thus amounting to the same thing.

<><><>

In Disciplined Minds, Jeff Schmidt outlined the ways salaried professionals are taught during their professional education to subordinate their intrinsic values in favor of values determined by authority figures. Or rather, he argued that these soon-to-be professionals are not taught a particular value system, but that the filters that determine their advancement to higher levels of professionalization select for people whose value systems are so subdued or non-existent that these values can easily be subsumed into the values of the hierarchies that surround them.

The claim is a simple one, if at all dark. The most educated people in a populace are not educated in ways that encourage them to take careful, critical, and holistic views of the world around them and to then assume responsibility for making changes where they deem necessary. They are not educated to recognize their agency apart from the systems that claim they have value. Rather they are taught to fit themselves into existing hierarchies of value, to derive their identities from success within these hierarchies, and, in turn, to define success according to a combination of prestige, professional title, and compensation.

Schmidt argued that qualifying examinations in the sciences were one of the first filters to select potential scientists who matched this ideologically subservient archetype. Leetcode for large tech companies seems to serve the same purpose.

This professional desire to fit into constructed hierarchies of competence and skill rather than to challenge them is a consequence of our education system which consists more or less entirely of this hierarchical positioning, a positioning in which advancement to a more “prestigious” place requires beating out many other individuals, who are thereafter deemed undeserving. The resulting hierarchy justifies itself because the people who have succeeded within it and thus owe to it some part of their identity and material comforts generally have no incentive to question it. So they replicate it into the future.

<><><>

Nothing I have written is new. People already recognize there is something amiss about using performance on Leetcode-style questions as a metric of ability. This sense of wrongness is sometimes stated outright but generally must be gleaned from the latent cynicism of comments from Reddit, Hacker News, and Blind.

------

It's becoming obvious to me that my time is better spent learning to solve these riddles rather than actually becoming a better developer. I have a job search coming up at the end of the year and whilst I've managed to largely avoid companies that ask this type of question, I believe it's seriously constraining my career.

[Hacker News]

------

I did 550 problems, 80 hard, 290 medium, rest easy. I can do most mediums in less than 20. Took me half a year and got multiple competing FAANGMULASS [tedious acronym for major tech companies] offers. You are barely scratching the surface. There are geniuses out there who can study for a month and nail it, I’m definitely not one of them.

[Reddit]

------

I have completed close to 1300 leetcode problems. It started with just being simple interview prep. But after each interview rejection/failure it become second nature to spend 30-60 minutes a day on leetcode. Fast forward several months later, I landed a job at google as an L4 SDE [Level 4 Software Development Engineer] with just 3 YOE [Year's of Experience].

For many this would be a success story. But a couple issues I've seen after spending 1 year at google.

For one I'm severely underperforming. One of my TL's [Tech Leads] for the project I'm working on explicitly has told me the expectations are higher for L4.

[Blind]

------

And sometimes piercing through the din of cynicism is such a succinct articulation of the situation that it is clear that the supposedly subjugated worker has become self-aware even if they have not yet found ways to make of this awareness a powerful tool. In a HackerNews post titled “Leetcode has taught me that I'm a bad engineer,” a poster bemoaned their recent extensive but fruitless practice in Leetcode.

I used to think this job was a creative one, since writing frameworks and libraries for further use, documenting code and extreme programming made me think that I was building something new and useful.

[But] Leetcode isn't about fun and challenging things, it's about thinking in one particular way, spitting out solutions using the same exact data structures and jumping through hoops on command without philosophizing or creating anything that can be reused/extended.

------

In response, another poster wrote

------

Where on Earth did you get an idea that creativity was needed in the first place?

Creativity is not scalable, even dangerous, and big companies strive to scale => they need obidient [sic] soldiers, playing by the rules and just smart enough to not f*ck up a critical project.

Hence the Leetcode. It's a perfect way to ensure obidience [sic], just enough brains, patience and motivation to risk wasting few month of preparation to the interview for the chance to get in FAANG.

If you want to be creative — "go fund yourself"! :)

[Hacker News]

<><><>

What happened to the prospective machine learning engineer position? Unable to motivate myself to spend hours each night working through isolated programming challenges, I ultimately withdrew my application. Perhaps, I told myself, I would be more willing in the future.

Later, during the Great Tech Firings of late 2022 and early 2023, there was a culling of workers at Well Known Tech Company. Purportedly the company had grown too large and could no longer justify its head count. I wondered how I would feel if I were among the throng that had been let go. If I had spent many weeks or months of my life working through exercises whose main purpose was to get me to this place that I was now being ejected from, would I think all of that time spent was worth it?

Many of the employees who had been let go must have asked themselves this question. They probably found a satisfying answer. What is more certain is that after their firings they landed on their feet, likely because where they had just come from would be a benefit to where they would go next. Part of the reason people give so much of themselves to the existentially limited tasks required to be part of a place like Well Known Tech Company is that being part of something prestigious marks them as an accomplished elite who can thereafter use that mark as a proxy for the certifications which do not formally exist in tech.

The bargain is not new and is arguably the way institutional prestige functions in much of this world. But I can't help but think that one of the reasons the world is so unequal—in capital distribution, in health, in quality of life—and seems to become increasingly more so by the day is that we have defined the standards of success according to how high people climb within systems created by the wealthy and the powerful to augment their wealth and power. Our standards of prestige, status, and wealth are reflective of this, the individual attempting to increase each axis by affiliating with institutions that have more of it than she does.

Such a world carries its incentives in the same basket in which it carries its problems, mixing the two constantly, unable to separate one from the other lest the whole basket slip from the hand and tumble to the floor. Maybe we could free ourselves from the problems in which corporations with too much power squander the public good for their own ends, but it would likely require us to change the meaning of accomplishment in ways that strip people of the identities they have spent their lives building. The world at large might be in a better state after all this, but who would willingly sacrifice their sense of identity simply to improve the world?

<><><>

Send any comments or questions about the work to contact@perturbations.org.


Other Writing

Cover Image for Those Who Walk Toward Banality

Always what is hidden from view reveals what is foundational, and what one plainly sees (and what one takes for granted) are the superficial concerns of people who do not realize on whose backs their status and safety rests.

Cover Image for Pecan Pie

It is true what they say about time seeming to dilate at the precipice of the unexpected. Imprecise writers often tout this as a manifestation of Einstein’s claim that the passage of time is relative, the proverbial instant of happiness juxtaposed with a seemingly unending boredom.

Cover Image for A Constant State of Dissatisfaction

And here, too, is the goal: To see our experiences through a lens which takes them as ends in of themselves and not simply as means for some alternative present.

Cover Image for The World in Red

Gas lighting is too polite of a term to describe what is going on here. It is more like someone threw paint on you yesterday, promptly decided to reform their paint-throwing ways and forget their past life, and then asked you today why you’re going around marking the world in red.