Amazon interview experience

This article is a mix of fiction and non-fiction for entertainment and inspiration purposes.

My name is Alice. I have been working as software engineer for 16 years.  I change jobs every 2-4 years. It is not what you think – that I love to have challenges or seek higher pay. It is just how this field runs. When the companies have money, they hire people. If the companies run out of money, they lay off people. Alas, the layoff is unavoidable and frequent. I wish I knew this when I went to college for computer science major.

There is benefit to work as engineer. The work has trained me how to build things. I’m the fixer around the house (Not sexy, isn’t it?). I am capable of finding solutions and solving problems . “Alice can deliver” is a quote  from my performance review. But changing job every 2-4 years is daunting. The story starts now.

Table of Content

  1. Amazon interview prep
  2. The trip
  3. On-site interview
  4. The result

1. Amazon interview prep

The current company has been developing the internet devices. We want to hold a spot in crowded IoT. The developers receive the email on how many customers signed up daily. We are growing. But the rumor says the executives couldn’t find more funding. My manger hasn’t hold team meeting for a while. We continue on bug-fixing. The layoff is in the air. I have updated my resume and sent to dozen of companies. Amazon is one of them.

Since there is not much work around, I use the time to collect the interview questions and practice. I read online stories and get the idea that it is tough to pass the coding interview. Some questions seem really challenging. For example, I studied tree data structure in college, but never used in any of the job. I would fail if I run into tree questions. In the work, finding the right tool to solve the problem is more practical. And I am good at making things to work efficiently!  

But if I want to get a new job, I have to compete with those new graduates. They are equipped with latest updates in data structures and algorithms. I have no advantages whatsoever.

Weeks later, I receive an email  from Amazon. Sarah is a recruiter from customer payment department. She says she would like to schedule the interview for me. First I have to pass the online assessment. There would be two coding questions. I have one week to finish. I accept.

In this week, I focus on the basic data structures, such as arrays, strings, linked lists. I also refresh my memory of algorithms, such as binary search, sorting,  and greedy.

On Friday afternoon, I click the online assessment link. They provide an exercise for me to warm up before the test. It is an array problem. I solve the question quickly. This boosts my confidence. I move on to the real questions.

I have 45 minutes to solve one problem. The question statement is long. I guess they intend to disturb us. After I finish reading,  I figure it asks to sort the strings mixed with digits and letters. I could write a comparator to sort them. I write the code, test, and move on to the next one.  

The second question is the schedule of flights. Given the list of flights with their mileages, optimize the sequence so that the overall travel distance from A to B is minimum. This could be done using the HashMap and PriorityQueue. I finish coding and submit. I feel lucky these questions are not as crazy as those on coding practice sites.  

Couple of days later, I receive the email from Sarah saying that I passed the online assessment. Amazon would fly me to Seattle for on-site interview.  She also emails me the preparation materials. One of them is “leadership principles”. I have to prepare a few projects to demonstrate I master those principles.

I am not too worried about the leadership or behavioral questions. After years’ working experience from job to job, I could find the stories to fit in those principles. Sarah also mentions I should prepare for the system design. By looking at some examples of the system design questions, I think I should be able to handle them. I have worked on the scalability of the systems in the last 2 jobs.

The real challenge is the coding questions. I have to learn a lot to fill the gap, such as graphs, matrices, Dynamic programming etc.

I take a week off to prepare for the interview since there is no substantial work in the office. On Thursday, I receive the phone call from my manager. Our company layoffs around 60 people that day. That’s more than half of the employees. I’m one of them. I actually feel relieved. Now I could concentrate on the preparation one hundred percent.

For the next couple of weeks, I continue practicing the coding questions. I learn a lot about how to optimize by applying data structures or algorithms. But I am also stressed out that I would have to solve any coding question within 30 minutes. I ask myself, “Are you ready or not?” The answer is no.

2. The trip

The interview is scheduled on Monday. I take airplane on Sunday afternoon. The hotel is located inside the Amazon Seattle campus. The interview building is couple of blocks away. When I arrive at the hotel, it is still bright outside. So I decide to look around and might find a place to have dinner. There are no people on the street. And there are not many restaurants open. Finally I see CVS is open. I buy instant noodles for dinner.

At night, I take a last look at the flash cards I have prepared for review. I walk through the code in my head. It is hard for me to fall asleep. Next morning I get up and look outside the window. The floor is wet. It must have rained last night. I have breakfast downstairs. When I come back to the room, I change to a business casual suit (Next time pack the T-shirt, girl!). Looking at the mirror, I repeat “I got this!”- a  trick I have learned from “positive thinking”.

As planed, I leave room 20 minutes early. The street is full of people, cars and buses. I walk inside the building, straight to the front desk and check in. After signing a few paper, I get my badge and sit in the waiting area.

Amazon coding interview

There are a few guys sitting in the area. They might be interviewees as well. They all look in their 20s.  I feel a little ashamed that I might be too old for the game. Then I say, “What can I lose?”  I review the schedule for today. The first interviewer is the hiring manager. His name is George.

3. Amazon interview On-site

Round 1 – Couple minutes before 8 am, a young man walks to me. He looks in his 30s. He must be George.  We shake hands. He leads me to upstairs and finds the meeting room booked earlier.

He starts with a couple of “leadership principle” questions. One question is whether I have led a project. I talk about how I led the project to scale the servers in the cloud. He types on his laptop while I am speaking. Then here comes the system design question – a payment system.

Darn it! I know little about payment. All I know is from my personal financial experience. It catches me off the guard. From top of my head,  I grab some knowledges that relate to payment. The system should have billing, invoice, credit card info etc. George asks me to design the system and APIs on the board.  I draw circles to represent components and draw some lines between them. Meanwhile I write the APIs next to them. The writings overlap each other. It is a mess.  

George could tell I am struggling. Time is up. He takes the pictures of the board, greets politely and leaves the room.

Round 2 – The second interviewer is a lady. She introduces herself that she is a manager. She and George both work in the payment department, but in different teams. She starts with the leadership questions – “Tell a case that your decision helps customers”. I gives the case how I find the open source tools to save the team from paying 50 thousands of license fee.

Next she asks coding question. she presents the question as a use case. After she finishes the statement, I figures this problem could be modeled as a tree and could be solved by finding the “max path sum” of the tree. She agrees and lets me code on the board.  

max path sum

As I know, many problem in tree can be solved by recursion. Usually there are a wrapper method and helper method. I also add a class level global variable to transfer value between methods.

She seems to have doubts about the code. She questions me what the problem would be if there are many threads running the code. I don’t quite follow. We spend minutes discuss the use cases. Gradually I get the clue.  To avoid the problem, I shouldn’t use the global variables. The work around is to define the variable in the wrapper method as an array, then pass the variable as input for the helper. This data could be returned from array when it is called.  After I change the code on the board, she nods her head. I win her over!  

Round 3 – While I am catching my breath, here walks in a young guy. He might just have graduated from the college and looks energetic. He starts the coding session right away. It is a string concatenation problem. Given an array of strings, find the strings that concatenated from other words in the array. From recent study, I know DFS is the way to solve this kind of problem. For each word in the array, loop through all the possible substrings and compare with other words. Then using the substring as parameter, the DFS method calls itself to check further.  

I learn a new technique “memoization” during prep – Use a variable to store the result from the previous steps. If the input data has been stored, the result can be retrieved directly. This optimizes the recursion solution with better complexity.  

After I code on the board, the young man says that I am at the right path. He askes me to run the test with the code on the board. I use the sample data to run the test case verbally.  I fix some problems here and there. The methods return the expected result.  He accepts the answer. I am so happy and remind him to take picture of the board. I could win some points from this round!

Round 4 – This is the last round, I soldier on. Two engineers walk in. The senior one is a man. The other one is a young girl. She is the shadow of the interview. The senior engineer asks a  leadership question, how to help other coworkers in the project. I find an example from my experience. He quickly moves on to  the coding questions – implement a data structure stack with min method. The class should have push and pop methods. It also has min method to return the minimum value of the stack.  

I have seen this question in prep. My understanding is to have a variable to keep track the minimum value in the class. Also compare and update its value when pushing or popping data. He asks me to illustrate the data flow on the board. So I draw the diagram. He agrees with the approach and  askes me to write the code.

stack with min

I starts with the definition of the class and variables. When he sees I call “Stack” API to create an assistant stack, he stops me. I am not allowed to use any library, and I have to implement the data structure from scratch. There are only 15 minutes left. I am a little panic. Immediately I remind myself “you can do this!”. The layout of  linked list implementation becomes clear in my mind. I write the code quickly – define the node with next pointer, declare head node in class… Everything comes together. I finish push and pop methods by adding and removing nodes from linked list.  

After I finish the coding, He accepts the solution, and asks whether I have question for him. I ask how is the work in Amazon? He says proudly –  “ rewarding”. It is 12pm. They walk me downstairs to the front desk. We shake hands and say goodbye.

4. The result

I finish! I feel I could breathe now. What a journey!  Three coding interviews go well. My preparation pays off.  But I am not sure about the system design. George is the manager. He could vote me out. I am 75% confident.

In the next week, I nervously wait for the call or email from Sarah, but not email or phone call. I wait for  another week, still not phone or email. My hope drops to less than 50%. At the end of third week. I send email to Sarah for result. Another couple of days later, she replies “no offer”. The reason is “you are not a good fit for the team”. She doesn’t’ give more details.

I figure the “not fit” means

  1. I have no clue about the “payment system”.
  2. I’m not one of them (The average age of employees is around 30!)

Java coding interview youtube series
Java Coding Interview Pocket Book (2nd Edition)

Comments are closed