A post on how to increase the speed of coding

I decided to start giving interviews after solving close to 400 problems but realised in one of the interview that I was taking too much time to code the solution which I had solved previously. I thought it was due to interview pressure but later realised I was infact slow in writing code for already submitted solutions.

To improve my speed, I started revisting all the solved problems but gave up after solving 10-12 of them since there were too many to solve. Thats when I realised the power of Mock Interviews section in Leetcode. The mock interview section provides a timed mock interview enviorment with questions compiled from a random list of actual problems from OA, phone and onsite interviews. Most of the questions will be of easy/medium category and it gives a confidence when we solve them quickly.

The mock interview section also provides a score based on how others fared in the interview and it also gives score related to particular stream [Like Stack, String, HashTable, Graph etc]. We will have a good idea of which area we are lagging in the preparation based on the reports and can focus on those instead of revisting all problems.

Based on my experience so far, I would suggest the below methods to improve the speed of solving problems.

  1. Give one or two mock interviews every day and check your score
  2. Solve atleast two questions which were solved previously
  3. Most of the times in real interviews we get hints. If you are stuck at a problem already solved, look for hints and solve it
  4. If you are solving a problem for first time, try to think few times [maybe an hour max] before looking for hints
    • Think of possible data structures that can be used
    • Think of any patterns seen before
    • Think of possible ways to traverse a datastructure. for eg in tree/arrays - Traversing from right -> left or left -> right etc
  5. Participate in contests, do not get affected by rankings in the contest. The goal is to do well in interviews.

If any of you have other ideas please share :)

Comments (3)