Amazon SDE in-person interview
Tuesday, May 30th, 2006Foreword:
If you want the answers to the interview questions, you are most welcome to post comments and I will answer them.
I signed my first NDA so I can’t tell you about a lot of interesting things I learnt there. But everything else that I remember will be here =)
Early Morning
I went to Montreal today for the final round of SDE interviews. I had to wake up early, very early, around 5:30am to catch the plane at 7:30am. Deep in REM sleep when I woke up, I was dreaming I was… wait that’s not what I’m talking about here =)So, I took the plane, took a cab and then I got to the interview place. Man, that hotel is nice! I met with the PM (program manager) and she said I was to meet my first interviewer shortly. As expected, a few minutes later, there he came and introduced himself.
We went to a room, sat down and the interview started.
Interview 1
He introduced himself, talked about what he does, looked at my resume and asked me about my educational background, what I learnt in university etc. He asked what was the project I was most proud of, and he asked about something on my resume.
Then, he took a notepad and whipped up this diagram:

His question was: What is the radius of the circle? The answer is…. drumroll bobobobom bom bom… Beta *tshh*
Heh I looked at the diagram, mumbled something about cos under my breath, then i’m like… hey wait a minute! heh… He said that once, some person took as long as 10 minutes to find the radius. I guess that was just to check if the interviewee was utterly confused or something.
Next question: Given 3 sets containing positive integers as such:
S1= { 1, 7, 13, 27 }
S2= { 1, 7, 13, 21, 31 }
S3= { 7, 13, 21 }
Write pseudo-code that will return a list of all integers that are not found in all 3 sets. Running time?
That was a pretty cool question, very nice algorithm and it turns out it was one of the problems he needed to solve once, but in a real world context. I fumbled a lot, but with the proper guidance I was able to come up with a solution.
Next: Imagine you have a distributed system where requests go through a load balancer which is effectively a switch. Machines are connected to the load balancer and requests are passed on to them with some strategy. Devise a way such that each machine(hosts) would know about all the other host names, even when new machines are connected to the load balancer.
That was it for the interview. I left the room, went to the lounge and waited for my next interview. I had a chat with a few blokes there: Jason, Steven and Clive. They were all 1) older than me 2) more educated than me (they all had Masters at least) 3) more experienced that me(they all work… at IBM or some other bullcrap like that). But somehow, I think I was the ‘happiest’ person there. =) heh ignorance is bliss.
Interview 2
The interviewer introduced himself, looked at my resume and asked me about what I learnt in university. After the resume stuff, he briefly talked about himself, but on a personal level because he was not from the recruiting group (more on that later), but he was just helping out.
His question: Design an object-oriented program complete with classes, attributes and functions/methods, in the language of your choice implementing a directed, acyclic graph. Make sure to include all methods you think will be needed and implement the functions that will be critical in ensuring that the graph is acyclic and remains acyclic.
I started drawing the classes in a diagram looking a lot like UML, complete with attributes, etc. Of course the signatures and types changed along the way I was writing the program. This one was long… I was writing function after function…
The most critical method for ensuring the acyclic property is addEdge(Vertex o, Vertex d). I was writing this function down, but we were running out of time. Coding on paper is HARD. Especially when you’re as messy as I am. I sorta finished writing the classes and he came up with a special case and asked me if my code handled it. It didn’t I say, so he asked how I would solve it (no code correcting since there was no time left). I said something which doesn’t make much sense… under the pressure… and which was stupid. But hey, I realized my mistake, and the correct solution as soon as I walked out of the door; at least I learnt.
Interview 3
You’ve guessed it, it always starts like this: introduction, question about education, question about stuff on resume. This guy asked me the toughest question of them all. In retrospect it was not hard per se, but… I guess it was hard for me to come up with the solution. With a *lot* of nudging and hinting I did solve the problem.
Say you have an array of 1,000,000 elements. Each index of the array contains an integer ranging from 1 to 10,000,000.
The integers are in a random order. Produce an algorithm that will sort the array in O(n) running time.
Please ask me about it, I’d like to write down the solution =).
Now assume that instead of an array, you have a file that contains 1,000,000 lines of integers, arranged in a random order, ranging from 1 to 10,000,000. Assume this time that you only have 1,000,000 bits of memory. Find a solution that would output a file with the integers sorted. You still want the solution in O(n) running time.
Interview 4
The final interview was with the Program Manager and it wasn’t a technical one. What we talked about was: salary, relocation, seattle weather, work authorization status and whatnot. She also explained how the hiring decision is made: they meet up later on that day and discuss each candidate. She told me I’d get the hiring decision on Thursday.
Conclusion
Here are some lessons I learnt:
- Their interviews are challenging. (at least to me!)
- Sleeping the night before an interview is important. (playing Tetris WiFi definitely not recommended)
- They tackle really interesting theoretical problems in real life applications (Interview 2 & 3 anyone?)
- The main over-arching theme in all of Amazon’s technical challenges is scale.
- Their employees are passionate about what they do.
- They love UNIX.
- They make the interview process as painless as possible and come up VERY FAST with a decision.
- After I told interviewer 2 that the algorithm was very neat and that i wouldn’t have been able to come up with it within the minutes we had without his help he said: well, at least you got wiser!
- You learn a lot in interviews.
- I missed DemoCamp 6.0
To conclude, I’d say I got owned, nubbed, schooled and whatnot. I hit the rails a lot but eventually came up with the solutions with some hints. I should’ve slept properly the night before and we’ll see what they thought of my performance =)
Interviews can induce some stress and some headaches, but if you can expect what’s ahead, you’ll be in much better shape. I hope to help others taking the interview to prepare and to remove some stress on people’s chest.