DSA Review
Whiteboard Advice
- Communication throughout is key!
- Make sure to restate the question so you prove to yourself and the interviewer that you know the problem domain.
- Example of restating the fizzbuzz question:
```
“So I’d like to restate the problem to you to make sure I understand what you’re looking for. The sole parameter for my function will be an integer. The sole output of my function will be an incrementing array, starting from the number 1 and ending at the input number.
If a number is a multiple of 3, the output will instead be fizz
. If a number is a multiple of 5, the output will instead be buzz
. However, if the output is a multiple of both 3 and 5, the output will instead be fizzbuzz
. Is my understanding correct?”
- Make sure to ask about edge cases
- By stating edge cases, it shows you will be good at preventing bugs.
- Example of asking about edge cases:
“Now that I confirmed my understanding of the problem, I’d like to ask about some potential edge cases. Is it possible that the input would be a type other than a number? If so, what should the function do? Can the input be 0 or negative? Again, if so, what should the function do?”
```
- Simply ask if there are any test cases that the function should pass.
- Write pseudo code and check your logic.
- When translating pseudo code to code, and you forget syntax or method, ask interviewer. If they give you trouble, then just say you will leave as pseudo code for now.
7 Tips:
- Take a few minutes
- You can ask for a few mins to think the problem through. Just communicate you are going to do so.
- Write down steps of the solution
- Basically, this is the alogorithm portion of whiteboarding.
- Write pseudocode first
- Pseudo code defined as some half-baked code-looking stuff that lays out the structure of how your code will work.
- Just verify the logic is correct
- Don’t sweat the small stuff
- Technical interviews are about demonstrating depth and breadth of knowledge, personal strengths, and problem-solving abilities.
- Brush off mistakes and move on.
- Sit down. Be humble.
- When given critiques, take it and be grateful! DO NOT be defensive!
- Come prepared
- This is good for your state of mind in and after the interview.
- Review your work
- If you have time, review your work! If your work is wrong, you still have time to correct it.
- These two areas are really important to review:
- Algorithmic efficiency: Review whether or not you have found the fastest and most optimal solution given the requirements.
- Correctness: Check for edge cases and off-by-one errors. At least look for ways to improve the correctness of your solution.