“Success is not final, failure is not fatal: it is the courage to continue that counts.”
― Winston Churchill
Here is an experience of a failure that I wish to share with everyone. Recently I had an interview with a company (large travel company), and the interview went well until the technical question came along.
Now don’t get me wrong I did prepare for the interview, and did lots of questions (since I was expecting a hard interview):
1. Find if a subtree exist in a million node of a Binary Tree
2. Finding circular links in link list
3. Least common ancestor in a tree
4. Path between 2 nodes in a trees
5. Sum up tree nodes
6. Anagram in text
7. Practice my quicksort and mergesort
8. Wrote my own LRUCache, hastable (hashing function) etc how it works
9. Sql joins etc etc
Basically did most of career cup stuff.
And here is the thing, when the technical question was asked it was in fact a very simple one, and due to the fact that I over-prepared myself and ego kicked in I though I could do better, but in the end I screwed it up. The question was a rather simple one, it could have been answered in a few lines of code. In the beginning of answering it I was heading the right direction (i.e using a hashtable NOTE: most interview questions can be answered with hashtable)
Then I started to over analyze things, and though hmm I can do this faster if I did a merge sort O(n log n), which was not the right thing to do. Not to mention my mergesort is still a bit rusty.
All in all, I felt like I just threw up on the interview, although I did verbally answer the right question at the end, when s/he asked me that “if I can have done this in a simple approach, maybe there is a simple solution ?”, and it just hit me at that moment. Yes, of course I could have used this data structure in this way, and get the right results in these 3-4 lines of code.
But that in my opinion is too late, I would not have hired myself if I was in their shoes. For most of the time overthinking is not the right approach to the problem. Even though I did write down all the requirements of the question I still critically missed something because maybe ego kicked in or maybe anxiety of it. My mind had an analysis paralysis moment also, if you wish to read more about it, Scott Hanselman has also an excellent article on Analysis Paralysis
A quote from the article
I see so many issues and possible bugs that I’ve learned over the years that could derail a feature that I end up derailing the feature.
— Scott Hanselman
The moral of the story is keep it simple and don’t try to over think in an interview or in your programming, because you will over complicate things in those circumstances (there is only a certain limit of time and most of the time interviewee like to keep it simple), don’t let the time pressure sink into you, because if you don’t focus on whats on hand, you will derail and lack the focus of the real solution which in most time is just a rather simple solution. Keep it simple stupid !!!!