Tips for Algorithmic Exams
First, let's address a question: Is it better to practice LeetCode problems directly on the website or on a local IDE?
If the format is like the Nowcoder coding assessments, where you handle input and output by yourself, it's definitely better to write in an IDE. However, for LeetCode's format, I personally prefer solving problems directly on the website for two reasons:
1. Convenience
LeetCode has some custom data structures, such as TreeNode
and ListNode
. In a local environment, you would need to copy these classes over. Also, you can't test effectively in an IDE; after writing your code, you would still need to paste it into the website to run tests, so you might as well write it directly on the website.
Algorithms aren't like engineering code; they are relatively small in scale, so the benefits of IDE auto-completion are negligible.
2. Practicality
During interviews, most interviewers expect you to solve algorithm problems directly on a website, preferably explaining your thought process as you code. If you are used to coding without IDE auto-completion and compiling in your mind during practice, you'll write code faster and more confidently during interviews.
When I interviewed with Kuaishou, an interviewer asked me to implement the LRU algorithm. I implemented both the doubly linked list and the hash-linked list directly on the website, and everything worked perfectly on the first try, which surprised the interviewer.
During the fall recruitment, I was able to secure offers largely because my handwritten algorithm solutions exceeded interviewers' expectations. This was all thanks to the practice I had doing problems directly on the website.
Of course, if you really don't want to solve problems on the website, you can use my VSCode or JetBrains plugin for solving problems. These plugins are perfectly integrated with the content on my website.
Next, I'll introduce some practical "tricks" and debugging techniques to comprehensively improve your chances of passing coding assessments.