Live Coding

Live Coding

Common Pitfalls

  1. Unconfirmed Assumptions
  2. Lack of Communication (silence)11. Interviewers want you to do good, so you need to let them into your thought process.
  3. Missing errors and failing to correct them22. If an interviewer gives you a hint, you HAVE to listen.
  4. Lack of follow-through and analysis33. After writing, do not just say, “okay I’m done”; think through your solution again, think about test/edge cases, analysis, etc.

Talking Through Your Thought Process

Takeaway: The interviewer wants to help and hear your thought process.

You have to describe and explain as you go, you can’t just read code aloud.

No matter what is going through your head, you have to share!

Clarifying the Problem

When given a problem in a TPS, you should start by talking through potential issues and asking clarifying issues.

Remember: Your goal is to understand the problem!

Recovering From Mistakes

You will make mistakes, the question is whether you can notice and fix them.

When acknowledging mistakes, don’t get flustered. You have to continue professionally and knowledgabley.

If you are stuck, ask for help; and really listen to the hint you are given.

Testing Your Solution

You need to test your solution and evaluate edge cases in your head! Trace your code!

Tip: Remember to trace what is written; not what you think you wrote!

Algorithmic Problem Solving

Planning

  1. Start by asking clarifying questions to understand the problem
  2. Then, brainstorm an example input and output
  3. Build a naive solution
  4. Test the solution
  5. Iterate on design

Implementing

  1. Actually write the code
Example: Asking Questions

Q: “How would you find the kth smallest element in an array of integers?”

A:

Whiteboard Coding

When writing code on a whiteboard:


  1. Interviewers want you to do good, so you need to let them into your thought process.↩︎

  2. If an interviewer gives you a hint, you HAVE to listen.↩︎

  3. After writing, do not just say, “okay I’m done”; think through your solution again, think about test/edge cases, analysis, etc.↩︎

  4. “i” and “j” can end up being mistaken for each other or for “;”↩︎