LeetCode has become an interview preparation hub for all software engineers. Many college graduates have perfected their solution by practicing it repeatedly.
Arguably, LeetCode is considered the best place to prepare for FAANG employers. Mainly due to their interview styles and types of questions that overlap with the LeetCode database.
The popularity of LeetCode is not limited to job hunting engineers, it is also regularly used by employers to search for a good interview question.
I have personally used this website for both preparation of interviews and asking questions during interviews.
How LeetCode Evaluates The Best Solution?
The best solution on LeetCode website is based on algorithm performance that is evaluated based on efficient usage of memory and complexity of algorithm.
Does LeetCode Encourage Bad Programming Practices?
The LeetCode evaluation approach works for a software program that performs very well on a machine as compared to other programs. However, the LeetCode does not evaluate a solution based on other important considerations e.g. readability, maintenance overhead, reusability and many other good coding practices.
I have been writing software for more than two decades and learned a lot of coding best practices that are tossed out by the optimal LeetCode solution. Most of the LeetCode optimal solutions are poor at practical usage.
I would personally not prefer to write any program for just speed and memory optimization. It can be a good choice for lower level machine program optimization however for the majority of applications it is a bad choice to maintain.
A well written code is always easy to maintain and understand. Many examples on LeetCode show just the opposite of this. Many solutions though performing well are really hard to understand for an average developer. This is a big practical challenge that is faced by the software industry. A large chunk of software needs to be maintained as compared to writing a new software.
The LeetCode approach for problem solving is can be often used as an example of premature optimization that is described by Donald Knuth in his famous book series – The art of Computer programming
“The real problem is that programmers have spent far too much time worrying about efficiency in the wrong places and at the wrong times; premature optimization is the root of all evil (or at least most of it) in programming.” – Donald Knuth
Unfortunately, employers still prefer the LeetCode style optimal solution in interviews. The LeetCode programming approach works well for entry level programmer evaluation. However, it fails to evaluate the practical skills.
The Challenges in Maintaining Extremely optimized code
An extremely optimized code for high performance has many challenges that are faced during maintenance of a software. Some of the key things are listed here
Learning Curve
Any significant sized software written for production consumption requires multiple developers to maintain. It is very common that the developer who writes software does not always maintain it. In core software development companies, many people move around. Also the development team gets reformed often. This makes it essential to ramp up on inherited software code.
Learning software written by others is a challenging task and it becomes even more painful when code is very complex. Highly optimized code is often very complex and difficult to understand, modify, test and debug. This makes the ramp up process even harder.
Generally it is a good practice to simplify and refactor complex code areas from a long term maintainability perspective.
Code changes are harder
Main purpose of business software development is to drive efficiency. Business processes change with time and new requirements arise every day. This makes requirement changes and new feature development as an absolutely required step in the recent software development world. These steps require frequent modification to existing code to meet new customer requirements.
Complex code is hard to modify since it has the following challenges.
- Hard to test – it is important to understand the code before testing it. Since the code complexity is high it can often result in missing out use cases.
- Harder code coverage – Even though I do not encourage chasing code coverage numbers, it is a good tool to measure your testing at a very high level. Complex code is often hard to test due to multiple branches and difficult to understand logic.
Time to market is impacted
Modern software development speed needs to cope with the ever changing business changes. Software needs to be developed as quickly as possible. This requires developers to work on short deadlines. Making changes to a complex code area results in post production bugs.
- Write enough test cases – ensure using good test coverage.
- Do multiple code reviews.
- Refactor and simplify the code to support existing functionality.
- Ensure there are no regression issues introduced in refactoring.
- Once all the above steps are done then – Add new features and functionality.
These steps make software development slower and business loses on time to market.
Why is LeetCode used by Employers?
When we have so many challenges with the LeetCode approach, why do FAANG employers and many startups following them blindly still use it for hiring? Based on my personal experience with hiring at few employers here are some possible reasons
Early Rejection is key in hiring process
It Helps Hiring Manager Reject Un-prepared candidates easily
Interview process is time consuming therefore to save time and effort many poor candidates need to be rejected sooner than later. This is typically done using some of these steps
- Resume shortlisting – this is typically done by the recruiter and hiring managers. It takes a lot of time to shortlist the resumes that fit requirements. More and more candidates are using resume pumping techniques to get shortlisted so the process is becoming harder.
- Coding exercise homework – Although not very common, some employers do ask for a coding exercise to be submitted before calling any candidate for an interview. This coding exercise submission is evaluated by the hiring manager/team and based on their review candidates are accepted or rejected for the next round in the interview process.
- Initial screening – In this phase typically the hiring manager or their representative would talk to the candidate on phone or video conference. A lot of times LeetCode questions can be asked in these initial screening interviews to know if the candidate knows programming. Almost all FAANG employers follow this as a practice with slight variations.
Even though LeetCode is very popular for interview preparation, there are still many people who do not prepare well enough for the interview. Asking people to code in the very first screening interview makes it easier to reject bad candidates immediately. This way employers are able to screen more candidates.
Making Best Use of Experienced Interviewers Time
In an ideal world, all employers would typically require good and experienced interviewers to be present in all interviews, however this takes out a lot of time from experienced developers who are already engaged and productively delivering business needs. Therefore employers need to make best use of their time.
As a side effect, many employers use the help of junior employees to help filter candidates in interviews. This helps reduce the load on senior employees.
Though this technique works for most of the time, it has one key weakness. Junior employees and in-experienced interviewers sometimes reject good candidates. Therefore employers suggest they ask for programming exercises in the initial rounds. Most of these interviewers would look for good programming interview questions on the internet and land on LeetCode website. This causes many employers to ask similar programming questions in their initial rounds.
It Helps Interviewers
LeetCode makes the life of an interviewer easy. Since it has a lot of resources for taking an interview. I have personally accessed LeetCode many times just before conducting an interview to get a good question to drive the interview conversation.
How LeetCode Helps An Interviewer?
LeetCode has a huge database of predefined questions that can be easily asked to a candidate for their programming evaluation. The website organizes questions based on difficulty levels.
I personally like to use if for having a variety of questions available for multiple interviews. I sort the problems by difficulty level and ask an easy question first. This helps me start getting the conversation with candidates.
Another key benefit is to be able to browse the solutions. This simplifies your interview preparation since it helps evaluate the solutions provided by candidates.
Why Do Candidates Use LeetCode?
The Huge database of LeetCode is not just for problem solving practice. It is dedicated to interview practice for FAANG employers. This attracts a lot of job hunters to prepare for an interview. LeetCode offers many indispensable resources to candidates of FAANG employers who attract thousands of aspiring programmers.
How LeetCode Helps Prepare Candidates for Interviews?
There is no doubt that LeetCode is extremely focused on interview preparation. Following features make it super useful for candidates to prepare.
Thousands of Programming Problems
The huge database of questions is excellent for preparation. Programmers at any level can come to LeetCode and have a good challenging problem to solve. This makes it a popular choice for all job hunters who want to try out their programming skills.
Evaluating / Testing The Solution
LeetCode platform also allows programmers to submit a working code and get its evaluation. This makes it a very powerful feedback platform that speeds up learning.
Discussion on Solution
Each problem on LeetCode can be discussed in a forum that is connected to the portal.
This makes it easy for everyone to look for approaches other programmers are taking to solve this. Many times you will find a very good solution already posted on these forums.
The discussion forum supports all languages therefore you can also use ideas from another programming language and use it in your own language.
Finding Perfect Solution
Discussion forum and LeetCode Premium offers easy access to solutions that makes it easy to learn new programming techniques.
Conclusion
LeetCode is a powerful website for both candidates and interviewers, however a smarter use of it would make the interview process much better. It may be fine to start an initial conversation using a LeetCode problem, however relying too much on the best optimized solution for the problem is not an ideal way to hire the right people.
What do you think?