Approach to Programming Problems
Some basic steps:
- Make sure you understand the problem.
- Once you understand the question, try and example.
- Focus on the algorithm you will use to solve the problem.
- After you have figured out your algorithm and how you will implement it, explain your solution to the interviewer.
- While you code, it is important to explain what you are doing.
- Ask questions when necessary.
- After you have written the code for a problem, immediately verify that the code is correct by tracing through it with an example.
- Make sure you check your code for all error and special cases, especially boundary conditions.
Reference: Programming Interviews Exposed