Message on Whatsapp 8879355057 for DSA(OA + Interview) + Fullstack Dev Training + 1-1 Personalized Mentoring to get 10+LPA Job
0 like 0 dislike

2 Answers

0 like 0 dislike
Best answer
Solving LeetCode problems in practice mode or in contests is going to help you with some of the skills necessary for interviews, but there will also be skills that it doesn't cover.

All you need in order to do well in LeetCode contest is ability to write code for rather trivial problems relatively fast and bug-free. Your good performance will confirm that you are capable of that - but it won't tell much about your ability to write readable or structured code, to explain what your code does, to prove your solutions, to estimate their time complexity, to communicate with the interviewer in general, to adjust to changes in problem details etc. In theory, you can win LeetCode contest while being really bad at all of the stuff mentioned above. While it is true that some of the things are likely going to be there from LeetCode practice, some of the interview-related skills aren't needed for LeetCode, and aren't covered by LeetCode practice.

LeetCode is a good way to practice, but it is not as good as going through actual interviews. Get some real interview experience, get some mock interview experience and feedback on those mock interviews - and that's going to prepare you much better. Of course, things like mock interviews are harder to organize - at the very least they require involvement of another person, ideally with a specific set of skills and experience; so if you can't easily get that, LeetCode will be a good enough alternative.

In the end, if you think that the main point of an interview is to solve a problem - you are getting it wrong. It is not about the fact that you solved (or didn't solve) the problem - it is about all the stuff that you did along the way.
0 like 0 dislike

If you become good at LeetCode contests (i.e. 3–4 solutions solved in every contest)

  • You are able to read problem statement and implement a correct solution quickly.
  • You are not taking the easy way out by peeking at the hints.
  • You are more confident in your ability to solve problems.
  • You are essentially practising for online assessments, which is usually a prerequisite before you get a coding interview.

How does it not help even if you become good at LeetCode contests

  • Competitive programming usually does not and cannot differentiate between O(n) and O(n log n) solutions. However, in interviews, providing the O(n log n) solution can fail you if the intended solution is O(n) - for example finding the nth largest element in an array of distinct elements.
  • Optimising space complexity does not improve your contest score. However, some interview questions set a strong constraint on space complexity.
  • Problem statements may be presented verbally, and ambiguously. Contest statements are written and meant to be unambiguous. In interviews, you usually need to seek clarifications on the question and the constraints.
  • You do not need to explain the solution. In interviews, you need to explain your solution as you write the code. Your code needs to be readable as well.
  • You have no resources to refer to. A number of “hard” LeetCode problems can be converted into the well-known algorithms - for example, Dijkstra, Longest Common/Increasing Subsequence and Minimum Spanning Tree. In contest can you copy an implementation of the algorithm, in interviews you usually need to implement the algorithm from scratch, and explain it.
  • You are not learning optimally. You should be covering the necessary topics, not the topics that are presented in the contest.
  • Coding interviews ask non-coding questions as well. Coding contest does not prepare you for that.

The better way to prepare is to practice mock interviews with your friends.