I used the time between the last round and this round to brush up my coding skills and review a few standard algorithms. I knew that my coding skills were not up to the mark as the interviewer would expect. I was just hoping that I get lucky this time as well and get through to the next round and in the time I get before next interview, I shall work on improving it. Fortunately, I didn't have to make that effort. So, here goes the description of what transpired in that interview.
I got the call from interviewer at the scheduled time. He introduced himself as Jeffrey and talked about the team he worked in (I remembered the interviewer's name this time but not the team or what he did). Like the last interview, this time also I was asked to create a document on collabedit.com and share it's key. After this, he asked me about my work experience and asked me about a situation in work life which I found challenging and how did I go on to face this challenge. He probed me further with similar HR type questions like describe a situation which you showcased your team-player skills. I wasn't expecting such questions in this interview as I was expecting it to be similar to last round. I tried to answer them as well as I could. He asked me what are the facebook products you like. After I named Facebook news feed, he asked me what feature you would like to add or improve to better the product. This was the last such type of question, before he got down to asking a technical question.
The question was:
In PHP, there is concept of single class inheritance i.e. a new class can extend an existing class. You are given a php source file which contains a few classes defined in it. You have to print the class hierarchy in the given desired format.
For example, classes in php source file are A, B extending A, C extending B, D extending A, E.
The output should look like:
I said we could use a Tree data structure and do a BFS (Breadth First Search) to print it this way. Then I soon realized that I should use DFS (Depth First Search) instead and told him so. He asked me to go ahead and write down the code on how to parse the php file to get the desired output. I said we can use a left child-right sibling representation for the nodes of tree. I wrote down some code to show how parsing can be done. I could see myself that my code was half-baked. However, he let me off the hook on that code and asked me how to write down the printing function supposing I have constructed the tree and I have the root node. The task was simple for me at that point, write down the depth first search function for a node. But somehow, at that moment I wasn't thinking in terms of writing a simple recursive solution which could have done it easily. Then, I was thinking in terms of stack-based implementation of DFS. I didn't realize it at that time that I had to write the DFS not for a general graph, but for a simple tree structure. Hence, there were no complications of maintaining which nodes had already been visited. But I was thinking about how to handle the nodes already been visited while attempting to write the code and hence, the cluttered thought process which resulted in incomplete code in the stipulated time.
The interviewer interrupted me while I was struggling to write clean code, he said since he is running out of time, he asked me to stop writing the code and tried to reassure me by saying that I was on the right track. I too knew, I was on the right track but it was just that I was not using the right mode of transportation. I was trying to sail a ship on the road. He then asked me if I had a question to ask him, I asked him absent-mindedly similar questions that I asked from the HR contact. I don't remember what he said as I was having a conflicting thought running in my mind. I was thinking whether I should admit or not that I am a bit out of touch with coding. In the end, the confession mindedness prevailed over the practical mindedness.
I said to him that I had a confession to make that I am a bit rusty with coding and that's why I was struggling to write the code cleanly. I said that I was making efforts at that time to improve upon my coding speed and efficiency. I don't know what the interviewer would have felt but he agreed that I needed some work to do on my coding speed. Well, I don't know if my confession played a role in my rejection or was it the inability to give a proper solution to the question that led to my rejection. I believe that it was the latter.
A few days later, I got the email which tried to describe my rejection in the gentlest of words as possible.
Thanks for taking the time to talk on the phone with us. Your background is impressive, and we enjoyed speaking with you.
Unfortunately, we will not be moving forward with you in the interview process at this time. The volume of interviews we’ve been conducting combined with the quality of candidates that we’ve been talking to often forces us to make difficult decisions.
Rejections are always hard to handle especially when expectations from self are high based on your own past record. It took me a few days of pep-talk to self to take in the feeling of rejection and be ready to go on about work and self in a normal way. After rejections, one usually has the options of either hitting the bar to drown himself or to raise the bar to perform better. I decided to choose the latter option and I did clear the raised bar (will write about what I meant and how I did it in one of the posts soon).