Why I think LeetCode is not a great tool for tech interview preparation
What a lot of my friends were doing was solving algorithmic problems on leetcode or a similar site. I’ve done that in the past (and I personally like interviewbit a bit more for its “streak” feature) and I’m not sure I’d like to focus on that this time.
The reason is that in my experience leetcode (not sure about interviewbit) sometimes contain problems that seem to be more related to programming competitions rather than to tech interview. For instance: find the element that appears only once in the array while others have exactly three occurrences.
Solution for this problem is to use combination of bitwise operators that will work the same way as
x^y^x (this operation produces
y) works but when there are three
x^y^x^x = y.
Cool. But I don’t think I’ll be able to create this combination of bitwise operators in 45 minutes on a whiteboard even when I know the approach. And if I can — does it tell interviewer that I’m a good software engineer? Well, maybe that’s a good sign if I can do it but if I can’t does it mean I’m not good engineer?
I might be wrong but I think this question isn’t good for tech interview.
If I were hiring a person at my own company I would be interested in candidate’s ability to solve the problem but also in many other things:
- Ability to analyze the problem and to avoid unnecessary work
- Ability to explain thought clearly
- Ability to say “I don’t know” and ask for help
(By the way the good article about tech interview from interviewer’s point of view: “The Guerrilla Guide to Interviewing”).
While it’s for sure great to be able to solve such “competitive” problems I believe they require a slightly different skill set.
Besides that what happens if you don’t know the solution? You click “hint” button but still have no clue. You can google the solution and it’s great if that solution is for a similar (but not the same) problem, you were able to understand it and apply used approach to solve your problem. But if it’s the same problem there is a temptation to copy-paste the solution and move on. Yes, that’s not how it should work so you try really hard to read the solution line-by-line and understand it but without the goal “to solve a problem” that not as effective as it could be.
And if you don’t understand — you just move on without really learning new things.
About 2 years ago my friend gave me advice to solve all “easy” problems on LeetCode and pay way less attention to “medium” and “hard” ones. I think that is a great advice.