Pages

Tuesday, September 23, 2014

Amazon Interview - A lesson about how to gracefully fail

Amazon had been bugging me since last year about getting an interview for an SDE role so, I finally said yes (this was 7 months ago). The recruiter scheduled a phone interview with a guy named Saral Jain. Of course, I Googled him and sure enough, his credentials were really impressive - he's got a pretty intimidating LinkedIn profile and the experiences that he's got in his resume sounded really cool (i.e. I have no idea what they are). Anyway, I was confident enough about my skills at that time that I really didn't spend too much time fretting about it so I just did some practice coding in my notebook in order to shake off some rust.

I had high expectations for myself, having gone through a decent interviews with Microsoft and some other tech companies and so I said to myself, "How bad can this be". Well, as it turns out, it was as bad as it can get. My phone rang at exactly 10:30 am and on the other line, it was Saral. He sounded really kind so that calmed my nerves a bit. He spent the next 10 minutes breaking the ice by asking questions about my current work. I was doing pretty well and he sounded impressed... but that was the end of it. The next question that he asked was:

"Okay Jim, given an unsorted array, find an efficient way to get the median".

So first, I don't know what a median is. And second, he wanted a really fast solution so making a crappy one won't cut it. So I asked him what a median is. And it turns out that in a sorted, odd-sized array, it's the one in the middle. And of course, I told him - "well, we can just sort the array and then get the middle which would yield at least n log n of complexity" but of course, it was not the answer that he was looking for. He wanted an algorithm faster than n log n and so the longest 40 minute interview of my life had begun.

Over the next minutes, I tried to solve it and he tried to guide me on how to do it by using a combination of quick sort and binary search but I just did not get what he was trying to tell. If there is one sorting function that I am not well versed, it's quick sort :) I really struggled to find a solution but I really liked how Saral kept pushing me to the right direction as if he really wanted me to succeed but there's only so much you can do if you are unable to grasp quick sort in the first place. Suffice to say, the interview did not end well.

I was pretty disappointed with myself during that time. After the interview, I tried to look for the solution but it was futile as I cannot understand any of it at all - and well, I felt really really bad. This however made me realize how much I suck at a lot of things. I started to realize how little I know about Computer Science and Math and that I have to do something about it if I want to become this cool nerd that I envision myself in the future. This reality hit me hard.. and it woke me up.

Over the next few months, I started to assess and list down the cool things that I want to do in the future. "Well, for now, I just want to be able to answer the kinds of questions that Amazon or Google asks during phone interviews - then once I can do that without breaking a sweat, then I'll start to dream a bigger dream" - I told myself. So I should be taking algorithms classes right? But wait, I don't even understand the math behind it. So then take pre-calculus.. but I have a very weak foundation of Algebra, Trig, and Geometry.. sigh.. In order for me to understand all those fancy algorithms, I need to learn about the basic stuff first - and so I went to Khan Academy and started working on Algebra 1. And well, it was fantastic and I was glad that I started down that path. Now, I am proud to say that I now know what a linear equation is :)

So fast-forward to the present, I have now been taking a bunch of math-related stuff at Khan Academy as well as some computing courses at Coursera in order to apply all of those math knowledge that I have been learning. I've also started to take some Android courses so that I can maybe build and share something cool out of these things that I have been learning. Although I know that I still have a long way to go to achieve my goal of being able to whip up a fast median finder algorithm without breaking a sweat, I am glad to say that I am really enjoying all of these detours - and I am really thankful for this failed interview - because without it, I would probably still be sleeping. The quote below says it all:

"You should enjoy the little detours. To the fullest. Because that's where you'll find the things more important than what you want."

No comments:

Post a Comment