Technical problem-solving approach

You might come across interviews where you could not crack a coding question or sometimes you might be preparing for a technical coding interview. It is very important that you must communicate with the interviewer at every step in the process of solving a problem. He/She might give you some clue when you try to solve a problem which will greatly help you. In this article, I will get you through the ways to solve a technical coding problem. I have chopped down approach to problem-solving to several steps which are explained below.

1. Listen/Read

2. Brute Force

3. Optimize

  • Check for the unused information. Eg. the given array is sorted, the given matrix is a square matrix.
  • Make note of the time and space complexities and check if you can optimize it by reducing the time and space complexities.
  • Check if you can alter the data structure so that the algorithm can be faster.
  • Check if you can use a hash table to solve the problem in a better way.

4. Walkthrough

5. Implement

6. Test

  • Do conceptual testing which means go through your code thoroughly and check if it will solve the problem as intended.
  • Check whether the loop starts with the proper value and exits the loops the right time. Prevent any deadlocks.
  • Check for the code which is not standard and remove it.
  • Test the code with a small test case which will save time and make it easier to solve the problem manually.
  • Check for the special cases(null values, extreme values, multiple and single elements) and edge cases.

Fix all the issues that you have come up with and you are ready to go. I would like to say you that this is one approach to solve a problem. You can try several other approaches to solve a problem and choose the one best suits you. Happy coding!