- Start with the naive solution. It shows you understand the problem.
- Think out loud, even if it's quiet. It lets the interviewer help out if you get stuck.
- Write your own test cases. Write at least 3 test cases to show you understand the problem.
- Outline your algorithm on the IDE. It makes it easier for everyone to follow along.
- Refer back to each step of your algorithm as you're coding. This shows you can walk the walk.
- Dry run your code line by line against your test cases. Dont wait for the interviewer to ask you to do it.
- Offer to optimize the algorithm. Point out the bottleneck first then explain what you need to do differently.
- Solve for the running time. Solve it throughout your code then explain your nested for loop makes it O(n^2)
- Use good variable names. Thing1 and thing2 aren't good things to write.
- Abstract functions away. Don't spend the entire interview on a parsing function that isn't important to the algorithm
- Do it for the interviewer. Keep checking in with the interviewer if they understand what's going on or if you need to walk them through your ideas.