How to efficiently prepare for interview algorthism question
Published: 2023-03-31 04:02:58

Over the past few months, I have been struggling with multiple interviews. Each interview has required me to solve algorithm questions, which has been challenging. While I understand the importance of having a strong grasp of data structures and problem-solving, I find algorithms to be somewhat like a piece of equipment purchased out of passion, used once or twice, and then left in the basement to collect dust. As a new graduate, we must face algorithms, but once we secure a job, we may never need to utilize them again.

So how can we efficiently prepare for these interviews? Here are a few tips based on my personal experience.

### Where to Getting Started
Like most people, I started with LeetCode, a question bank containing numerous programming and interview questions that can be compiled and run online. You can select different types of questions, such as arrays, linked lists, binary trees, backtracking, and dynamic programming, making it an efficient way to practice unfamiliar concepts.

### How to Begin
The best approach is to choose a suitable topic from "LeetCode Exploration" based on your specific needs. This section contains high-frequency interview questions that have been carefully selected by LeetCode.

For those with a weak foundation or little experience with these types of questions, I recommend starting with easy-level questions in order and working to strengthen your fundamental knowledge during the practice process.

For those with a certain foundation, choose easy and medium-level questions according to data structure and labeling (pointer usage, union difference, linked list, hash table, heap, stack, tree, graph, memory search, dynamic programming) in turn. This will help you reinforce your knowledge of relevant data structures. If you have strong abilities, you can challenge yourself with hard-level questions to gain a deeper understanding of data structures.

Select high-frequency questions one to two months before your interview. Prior to that, focus on building a solid understanding of data structures and a good problem-solving mindset by working on easy and medium-difficulty questions. When practicing hard questions, you will expand your thinking and gain deeper insights into the topic. Many hard questions use clever methods, such as Largest Rectangle in Histogram and Maximal Rectangle. When reviewing previously solved questions, you will find them less difficult than before.

During the practice process, it's essential to form good habits. Collect classic or challenging questions that you don't understand and review them regularly. This will gradually strengthen your problem-solving skills.

### Additional Advice
Remember that it's not necessary to go through every question on LeetCode, and completing more questions doesn't guarantee you will master interview questions. Rather than focusing on quantity, focus on quality. After solving a question, take some time to review other people's solutions, and you can always learn something new from them.

Don't spend too much time on a hard question. I recommend going through some easy and medium questions and a few hard questions for approximately 1-2 months since most interview questions are not at the hard level. Spend more time on basic questions and ensure you understand the key idea behind solving them.

Finally, during an interview, if you face a question for which you don't have a solution, try to explain what you're thinking and break down the problem. Explain how you would attempt to solve it and any challenges you are facing. It's always beneficial to communicate with the interviewer rather than attempting to solve the problem alone.

### Lastly
Always keep a positive attitude, and don't get frustrated for some failure,it could be a difficult time, but still as long as you have the determination and passion, you can always make things happen. I wish everyone who is struggling with interviews the best of luck in getting offer of their dream job!