code Algorithms & Hiring

My Mixed Feelings About Coding Interviews

Thoughts on interview prep, LeetCode, and the algorithmic categories that mattered most during practice.

These days, coding interviews are like security checks before getting into big companies, and they keep getting more competitive. It is not uncommon to hear someone fail coding rounds multiple times before eventually landing a decent job. I got dinged twice myself at the beginning of 2021, which is why I started rethinking what I should do about this trend, whether I like it or not.

I have heard many people, usually mid-senior level and often the losers of this coding game, argue that coding interviews are not reflective of a person's actual capability. There is truth to that. However, in a market-driven economy, coding interviews are still a proven and efficient way to screen people. Back when I was interviewing candidates at Bosch, I understood the pain of choosing among many qualified people. A coding round can act like an efficient weeder for the less prepared candidates. It is imperfect, but it is also practical.

The real question is how we should navigate a market that already works like this. Coding interview skills are not exactly the same as actual coding skills because the game is heavily algorithmic. In my years of doing ML research, I almost never needed a heap or fancy data structures to process my day-to-day work. Yet on a coding prep site, there is always a decent chance you will run into a heap question. Should I complain? Should I just keep doing research, publish papers, and stay in academia? Or should I get on the train and do LeetCode as well?

I am more of a realist, so my answer is to tackle LeetCode questions with a clear structure and to use that process to rebuild a stronger algorithmic foundation. ML, stats, or math skills are like the "devil fruit" power, but coding skills are still the basic combat power you rely on in a rapidly evolving tech world.

I am taking my baby steps.

Array, Stack, Heap

  • Array questions are prevalent but often combined with other categories. Array questions I practiced.
  • Two Pointers are large enough to deserve their own page.
  • Common array subpatterns: hashmap / Two Sum, graph problems hidden in words, and matrix-style scanning.
  • Stack questions on LeetCode are not very intuitive. If not thought through carefully, they can fool you into O(n^2) solutions. The correct answers are most of the time O(n).
  • The trick often lives in a while loop nested within the main pass, or in using a two-dimensional stack rather than a one-dimensional one.
  • Heap questions are intrinsically more challenging, but once you get used to priority queues in 2D heaps and two-heap moving-stream problems, many others look like variants of the same idea.
  • The core idea about heaps is to leverage their natural sorting capability: top-K, merge many sorted streams, and maintain moving order statistics.

Tree and Graph

  • Tree questions revolve mostly around BSTs. To grasp them well, it still helps to go back to CLRS and read the BST chapter thoroughly.
  • Important reminders: recursion base case first, get comfortable with stack for DFS and queue for BFS, and practice serialization / deserialization and tree construction from traversals.
  • Graph questions are involved, but once the pattern clicks, they are much more within control: union-find, BFS templates, DFS templates, Dijkstra, A-star, and building adjacency lists early.

DP and Backtracking

  • For DP: base case, transition function, and how to break a problem into subproblems. Starting with recursion, then adding memoization, then tabular DP remains the cleanest path.
  • Backtracking is a tricky category, but templates help: subsets, permutations, combinations, combination sum, and palindrome partitioning. The core is still incremental construction plus abandoning a candidate as soon as it cannot lead to a final solution.

The Practical Summary

Eventually, muscle memory works faster than the brain. There are patterns in each category, and some of them simply need repetition. In the LLM era, I do not see much value in merely memorizing answers, since these tools can outperform that kind of preparation very easily. What still matters is demonstrating your understanding of the problem and the quality of your thought process.