Many are under the impression that a few minutes of online practice solving problems is enough. Considering the temptation to jump to the solution when they can’t solve the problem, this form of preparation isn’t at all productive.
So how should you prepare?
Following these steps will lead to more effective use of your time:
Choose a rhythm
Doing 2 or 3 problems a day amounts to approximately 3-4 hours, which is a lot. The recommended number is probably just one a day unless you are preparing full time.
Solving numerous tasks in one day will be mentally exhausting. Like any task, once you go beyond a certain point (perhaps the 3rd or 4th problem) there will be little benefit. Once you reach this point, your mind will start fast-forwarding to the solution without appreciating the process, or where your strengths and weaknesses are.
Dedicate time to solve a problem yourself
Even if it’s just 20 to 30 minutes, spend this time solely on trying to find the solution, an idea of the correct output without skipping ahead. This may feel like a very long process and use brute force if necessary, but this will greatly help you comprehend the necessities to optimize it further down the road.
Don’t panic if you hit a brick wall
There will come a point where you are stuck. Take a breath, start fresh by looking for hints and then try to solve the problem again. Repeat the process until there aren’t any more hints. Only then can you read the problem statement or solution. However, don’t read it all. As soon as you feel like you understand, stop reading and try to use the information to solve the problem. If you still can’t get to the solution, continue reading just a bit more until you find another break-through.
Below are some extra pointers that have helped people prepare:
- Rewrite the solution in a different programming language. Doing so allows you to consider the abstractions and improve retention.
- Save the problem and go back to it, each visit for a longer period of time, also known as spaced repetition.
Ask yourself some questions at each step:
- What have you learned up until now? What should you consider before attempting to solve the problem next time?
- What pattern or technique was used to get to the solution?
- What was the hint needed? Were you far from solving the problem?
There are a few things that you must be fully aware of before attending an interview, or even a mock interview:
- Hash Tables- a critical data structure that you must be able to implement from scratch
- Stacks/Queues- make sure you understand data structures like FILO and FIFO
- Linked Lists- singly-linked lists, doubly linked lists, circular lists
- Trees-learn about balanced binary trees and how they are implemented, basic tree/node construction, traversal, and manipulation algorithms. There are also subsets that you should be familiar with, such as n-ary trees and trie-trees.
- Graphs- learn the pros and cons of graphs including objects and pointers, matrix, and adjacency list.
- Algorithms- As well as a binary search tree, and graph algorithms, you need to investigate the details of at least two n*log(n) sorting algorithms. Quicksort and Mergesort are popular choices.
When you look at the list, there is a lot to learn and it might be best to use the traditional flash-card method. Nowadays, there are plenty of flash-card apps and even guides and quizzes.
Mock Interviews are Crucial
Before facing a real interview, a mock interview is the best way to prepare you for the actual situation. Use the same techniques that you will in the actual interview, so for example, if it’s a whiteboard interview, use a whiteboard.
Further things to consider:
- Carry out mock interviews with a fellow software engineer and when possible, at the same level. This person should be able to break down problems into hints.
- Use a timer and set it to 30 minutes. Standard interviews will last between 45-60 minutes, so reducing your time in a mock interview will give you more confidence on the day.
- Ask your mock interviewer to assess your approach to the solution rather than expect you to find the solution straight away.
- Make sure the challenges you are practicing are some of the more common ones, this way you will maximize the use of your time.
- Listen to the feedback and use it to improve
- Be the interviewer, it will allow you to see things from a different point of view and see what a company is looking for in a candidate. Another advantage of this is that you may appreciate how nervous an interviewer is.