LeetCode, Coding Interviews, And The Notion Of “Signal”

or “How the LeetCode interview debate is similar to traditional college vs. coding bootcamps”

Evan SooHoo
Better Programming
Published in
8 min readJan 24, 2023

In the name of Kadane. PEACE THROUGH POWER!!!

I was recently working through Collection Of Really Good Interview Stuff, or CORGIS, the webpage I compiled that has yet to take off. It was supposed to be Yangshun Tay’s Grind75 with 75 YouTube links but had it taken off, I was planning to update it with a more fleshed-out system design section.

While working through Maximum Subarray, I had a thought — the implementation itself can be characterized as straightforward (shown above), and there are many uncited claims that Kadane himself worked it out in minutes… but how could the average interviewer figure this out under pressure? Would they also be expected to prove the correctness of Kadane’s algorithm mathematically? Regardless, what does the ability to produce code like this really have to do with software engineering?

The LeetCode coding interview argument is ongoing and will likely not be resolved until after we are dead in the ground, buried beneath the red-black trees as the remaining humans wage war against the sentient GPT-7. While browsing through the latest iteration of the debate, though, I encountered a few arguments that stuck out to me:

  • Coding interviews are designed to look for good “signals”
  • Anyone trying to teach others to “crack” coding interviews (except McDowell, whom I think was just making a pun) by skipping computer science fundamentals is completely missing the point. Memorization will get you nowhere. Memoization, on the other hand…

The rest of this article will be an expansion of that debate. If you are against coding interviews of this nature, I think the argument is already well-known: It’s a waste of time, an opportunity cost, and irrelevant.

Computer Science vs. Software Engineering

If you want to become a professional software engineer, should you go to college, be self-taught, or sign up for a boot camp?

I can only really speak to one of these options — traditional education, which is what I did. I did have the pleasure of meeting someone who self-studied and became a professional full-stack engineer in six months, which I wrote about on HackerNoon. His story is inspiring because it cost him virtually no money.

This is an article in favor of coding boot camps, and I was amazed at how much it resonated with me despite being from the opposite background. A boot camp streamlines the process by skipping all the math and theory. On the other hand, a computer science college education can be considered a form of gatekeeping (my term, not his). By focusing on real, applicable skills and quickly getting to projects, boot camps create a much lower barrier to entry.

Finally, this eloquent post describes software engineering and computer science with equal measures of passion. The author advocates for computer science education because it “prepares us for a wide swath of careers, instead of just giving us relevant tools today.” It lays a foundation. It does not constantly change. Even if you did not study computer science in college, you have probably encountered it more times than you realized: When using regular expressions, for example, or when using async. The author once built a Turing Machine simulator in 133 bytes. Was it useless? Yes. But he learned a ton.

I would encourage everyone to read these two articles, but I acknowledge that not everyone will want to do that… so here is more of my personal commentary. First, not all colleges are created equal — the University of California system, for example, is notoriously hypothetical, whereas some colleges are more hands-on. The theory itself is of some value. I have a copy of the requirements for my own college here, and I see they have not changed much — to get the degree, you need a C class, a data structures class, upper-division classes in operating systems, networks, computer architecture, and algorithms…

…a year of Calculus, a bunch of general education, a science series like chemistry so you can do lab work with the pre-pharm and pre-med people…

…elective upper-division classes, so you can study combinatorics and/or hacking, writing, and yes. Then you get the piece of paper.

On a HackerNews debate, one person who goes by swat535 made this argument:

I graduated with a CS degree and a minor in Web Services and Applications. Let me tell you that whilst those topics are useful, they were pretty tailored, and if I’m being 100% honest, I don’t even recall the majority of them.

My day to day job is piping APIs together and making sure we deliver features on time.

On the rare occasion that I need to use a data structure or an algorithm to optimize for Time Space complexity, I’ll either use a community built package or a language level feature. I’ll never invent my own because whatever I come up with will be half baked anyway. — source

I think the transition from college to business goes a little something like this: You arrive with all this hypothetical knowledge, a percentage of which is relevant. On day one, your stern boss points you to a non-documented, enormous codebase and asks you to do something with it that no one else has ever done. Fearing for your job, you hone in on the small subset of college topics you can reach for.

The difference between coding in college and coding in the real world is that there are way more variables… both figuratively and literally.

A few years later, much of your college knowledge has been replaced with extremely specific domain knowledge. You would fail one of the midterms you still own a paper copy of, but your hands can set up an environment, deploy containers, comb through a large codebase, and search for bugs like it is second nature.

Then LeetCode comes out of the woodwork again…

Back To LeetCode

If anyone reads and/or likes this article, I may follow up with another called “A Random Walk Down LeetCode,” in which I run through and share Gists for several common problems I have encountered, but here’s how I planned to start:

So, let’s say, for the sake of a hypothetical scenario, that you are brand new to LeetCode. You have already conquered FizzBuzz, and so you try to face off against the easiest problem with the largest acceptance rate and a decent ratio of likes to dislikes. You find Jewels And Stones.

The scenario is a tiny bit confusing, but you have characters that represent jewels, and you have characters that represent stones. All jewels are stones, but not all stones are jewels. You just want to know how many jewels there are.

Input: jewels = "aA", stones = "aAAbbbb"
Output: 3

Fine. a and A are jewels. I count three jewels, and b is just a stone. Okay… easy. This is just another FizzBuzz, a test that demonstrates you know the most basic coding.

Nope! You’re… fine. My outdated C++ code just failed, as O(JS), where J is the length of the jewel’s string, and S is the length of the stone’s string, has failed.

This, on the other hand, passes. The time complexity is O(J + S), not O(J * S). The code above will probably confuse anyone who uses a programming language other than C++, and annoy anyone who uses modern C++. This better solution by someone else uses a set instead and the auto keyword, but I swear, this kind of problem comes up constantly in real coding interviews. You find some problem that is easy to solve without a hashmap, but a hashmap helps.

Technically an unordered_map is a little different, but it is a close approximation of a hashmap.

Of course, hashmaps are not the solution to everything. I tried to solve this different problem in a real interview with a hashmap. The three lessons I learned that day were:

  • Spend a little time talking about what you are going to code before you code it
  • Don’t use a hashmap for the string compression problem
  • Don’t assume hashmaps are the solution to everything

You may have encountered 14 coding patterns, but I say solve-it-with-a-hashmap problems should be the 0th pattern. Next comes the two-pointer technique, which I have seen come up in real coding interviews as well.

But sometimes, I can’t help but think… maybe a lot of these coding interview resources are missing the point. Hashmap problems are fair because they tie to a fundamental data structure. If you do not know what a hashmap is, you can read about them here, then you can read about how they are implemented and how they deal with collisions, and then you can even have an enlightened discussion with your interviewer about why hashmaps are relevant to compilation and interpretation.

But if you look too hard for shortcuts, you end up with a bunch of memorized facts that quickly fall out of memory and are not particularly versatile. You have solutions but do not remember what problems they are relevant to. You do not know what they mean or what broader topics they relate to.

What Is Signal?

“Signal” is a topic so hand-wavey and nebulous that if you try to look it up, you have to wade through a bunch of more relevant and interesting articles detailing how the app works.

A popular YouTube user refers to “signal” constantly here:

A “signal” is just something you implicitly provide in an interview, the underlying characteristics that the interview is designed to tease out. In Ustav’s words: How do you code under pressure? How do you regather your thoughts when you stumble? How do you approach a problem you have never seen before? Should you regurgitate a solution you memorized, the signal will be useless.

Closing Thoughts

If you do not think LeetCode-style coding interviews are fair, then I doubt this article has convinced you. It was more of an aggregate, a collection of differing opinions.

But coding interviews test for computer science knowledge. Computer science, unlike all the skills and knowledge you employ as a software engineer, does not change at such a rapid pace. It can be argued that computer science is still widely taught today because the fundamentals are important — and because (controversially) it is easier to go from a computer science foundation to real-world software engineering than it is to go from real-world software engineering to the relevant bits of computer science you will need.

If this article receives positive regard, I will also write an article about how LeetCode problems are an intellectual endeavor not unlike a Chess puzzle.

Should this article receive a negative opinion, here is a link to a YouTube video called “corgi snow tunnel 2023.” At least you got THAT out of clicking on it.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

Evan SooHoo
Evan SooHoo

Written by Evan SooHoo

I never use paywalls (anymore) because I would get stuck behind them.

No responses yet

What are your thoughts?