This is a brief but concise summary from Programming Interviews Exposed.
What the interviewer wants is to see your thought processes as you work through each stage of the programming problem.
Even if you immediately know the answer to a problem, just don’t blurt it out. Break the answer down into discrete steps and explain the thought processes behind each step.
Demonstrate that you have logical thought processes, are generally knowledgeable about computers, and can communicate well.
Keep talking! Always explain what you are doing. Otherwise, the interviewer has no way to know how you tackle complex programming problems.
SOLVING PROBLEMS:
- Make sure you understand the problem.
- When you understand the question, try a simple example.
- Focus on the algorithm and data structures you will use to solve the problem.
- Explain yor solution to the interviewer.
- while you code, explain what you are doing.
- Ask questions when necessary.
- Test your code with an example.
- Test it for all error and special cases, especially boundary conditions.
WHEN YOU GET STUCK:
- Go back to an example.
- Try a different data structure.
- Consider the less commonly used or more advanced aspects of the language.