What steps do you follow during the interview and while doing a question on leetcode?
I find myself wanting to jump immediatly to coding after I read the question. I know this is not good.
Here is my current plan and steps I try to follow:
- Read the question.
- Ask clarifying questions. Ask about edge cases
- Go through an example by hand. To demonstrate I understand the question and the interviewer agrees
- Think of the simplest solution possible. (usually bruteforce). Explain it verbally.
- Try to think of a faster algorithm to solve the problem. Verbally explain it
- Go through an entire example using my algorithm to solve the problem
- Then begin to write code with the interviewer's permission
- Review the code and go through line by line with another example, executing by hand
- Then execute the code if I think everything looks good
Is this a good plan? I dont know if I will have time to do all of these steps in an interview. Does anyone know if there are any books that detail a step by step guide like this?