Amazon technical interview questions and answers

Amazon technical interview questions and answers

When it comes to tech, no one’s doing it better than the world’s top internet retailer by revenue: Amazon. Founded in 1994 by Jeff Bezos, a former hedge fund manager, Amazon is now – apart from being a retailer of household goods - an entertainment company, a publisher, the creator of a home assistant and a newly minted grocer.

But first and foremost, it’s a company that relies on technology. Be it Prime Air, which is designed to safely deliver packages to customers in 30 minutes or less using drones, or its latest patented technology, a drone that can carry a battery charge for electric cars and deliver them to cars out on the road that need them en route, Amazon’s tech has put the behemoth on the road to the future.

No wonder then that there has never been more interest in jobs at Amazon than there is today for top tech talent. With plenty of technical jobs available, there’s opportunity to find a career that matches your skillset.

But getting hired isn’t easy. Like most top tech companies across the world, Amazon has a rigorous multi-tiered interview process to hire the “best of the best”. Why? In 2004, Bezos said in an interview: “I’d rather interview 50 people and hire no one than hire the wrong person.”

Interview processes can vary depending on the role and position, but this is a general format that people applying for a technical role can expect: phone interviews, coding test, and in-person/on-site interviews (including technical interviews).

It’s important to be up-to-speed with code, algorithms, data structures, code organisation, and simplicity, but there’s more to the technical interview round. Here’s everything you need to know about Amazon technical interview questions and answers:

Make sure you can back up your claims

Neil Roseman, former Technology VP for Amazon and Zynga, has interviewed hundreds of people. He develops most of his questions to “find out what somebody really did, as opposed to just being an observer or a participant.” “They might think it sounds good to say 'I improved system availability by 50%’, but if we’re hiring someone for a system engineering role, I need to know they actually did that. In most cases with high-level statements like this — which appear on resumes all the time — the person actually hasn’t done it or was just a participant, and understands very little,” he has said in an interview. Good candidates, he says, will be able to explain and backup their claims no matter how far you drill down.

Brace up for a soft beginning…

Roseman begins by asking potential hires to introduce themselves and give him a couple of minutes about what they’re “interested in and most excited about.” “This ensures we’re both comfortable,” he says. He then gets started with the most hands-on technical questions. “For an engineering position, the reason most people don’t get hired is because they simply don’t have the skills — they don’t pass the technical bar,” he says. Interviewers at Amazon typically pay attention to the candidate’s area of focus. If it’s coding, they may be asked a coding question based on their experience. But then be ready to have to dig down deep and answer detailed questions.

Be ready to meet your bar-raiser

Amazon runs a program for “bar-raisers”, its top-performing employees, who apart from their job responsibilities, often conduct interviews for other teams each week. This, Amazonians believe, is one of the ways Bezos cuts risk on hiring the “wrong” people. Managers working to fill spots on their own team often make mistakes in hiring due to stress or desire to get the role filled as soon as possible. The bar-raiser, who belongs to a completely unrelated team, has no incentive/stress/desire to get the position filled as quickly as possible. They are interviewing to ensure only one thing – that Amazon hires only the brightest and the best.

Focus on the questions, but don’t forget to ask your own

Many interviewers end up asking candidates how they would solve the kinds of problems their company actually faces. “While at Amazon, I often asked a design question that’s based on the recommendation system — the ‘people who bought also bought feature.’ It’s always best if I cast this in terms of a product that people know. That way you see if they’re both product focused and solution focused,” Roseman says. He often also pressed candidates on product design, believing that great engineers “should not simply be order takers, but actively part of product development.” “We want employees to ask questions. I want co-workers who ask questions and don’t just sit in the corner and wait to be given orders,” he says.

Don’t diss the soft skills

Jeanne Skinner, a leadership recruiter for Amazon, stresses on the importance of soft skills and culture fit. “As a job seeker, we want you to show us recruiters why we should invest our own internal reputation capital on marketing you, your background and your capabilities to our leadership team,” she says. It’s important for you – and your body language – to show that you’re a proactive, inspired person. “I’m looking for the people who embody the phrase ‘fortune favours the prepared.’ It’s the willingness to be ready and take advantage of every opportunity that presents itself,” Roseman adds.

We leave you with a long list of curated questions that have been asked at Amazon technical interviews:

1. You’re given a Boolean 2D matrix; can you find the number of islands?
2. Given an array of strings, find if the given strings can be chained to form a circle. A string X can be put before another string Y in circle if the last character of X is same as first character of Y.
3. Tell us an efficient data structure for minimizing the following operations if we have an array arr[0 . . . n-1].
4. Add a value x to array from index l to r where 0 <= l <= r <= n-1
5. Find the value of a specified element of the array arr[i] where 0 <= i <= n-1
6. Is {a, n, d} a palindrome? If you are given a random string, is it a palindrome or not?
7. Given a linked list, reverse K nodes in it.
8. Search for an element in an array which has elements who’s values are first increasing and then decreasing. (Use modified binary search)
9. Find the second largest element in an array.
10. Given a sorted array which can have repeated elements, find the occurrence of an element. (Most optimal solution is O(log n) – Using binary search to find start and end occurrence)
11. Make a data structure and implement an algorithm to print all the files in a directory. (The root directory can have sub-directories too.)
12. Convert a BST into a DLL and DLL to BST in place.
13. Vertical traversal of a Binary Tree.
14. Lowest Common ancestor in a Binary Search Tree and Binary Tree.
15. Implement a stack with push(), pop() and min() in O(1) time.
16. In Facebook, find an efficient way to find the mutual friends between you and one of your given friends. Hint: hashing, dictionary data structure implementation
17. For two very long numbers given, find the product of these numbers in an efficient way. Hint: using binary multiplication effectively.
18. Given a number n, find the number just greater than n using same digits as that of n.
19. Convert Binary tree to linked list.
20. Rotate a matrix by 90 degrees.
21. What is the definition of tree?
22. What are the differences between graph and tree?
23. When can you say a graph to be a tree?
24. Write a program to show whether a graph is a tree or not using adjacency matrix.
25. Given two numbers represented by two linked lists, write a function that returns sum list.
26. What steps are taken when the OS shifts from one-thread execution to another?
27. What do you mean by constant time complexity?
28. What do you mean by hashing?
29. What is the function of DML Compiler?
30. State at least four kinds of indexing.
31. Discuss the UI problems of a previous project, how would you resolve them now?
32. Why is it easy to collaborate on a document in person but hard on the web?
33. How are requests handled in Resin (or a Java servlet container in general)?
34. How does dynamic recompilation work in Resin (or any other Java servlet container)?
35. Given a distributed system with many clients and many servers where the servers each export a different set of services and each have a different amount of computing power discuss the data structures used in a router to perform load balancing.
36. Write a function that given a list of items and weights return a random item in the list taking the weights into account.
37. Now write a O(log(n)) function
38. There is a big file of words which is dynamically changing. We are continuously adding some words into it. How would you keep track of top 10 trending words at each moment?
39. Write a function that returns the length of the longest leaf-to-leaf path in a binary tree.
40. Find an element in a sorted rotated integer array.

Good to know: Each time you write a code, don’t forget to check for the edge cases. Never make the mistake of assuming anything; there’s never a no to questions, especially if there are any doubts. The following books may be helpful with your prep:

• Cracking the Code Interviews
• Programming Interviews Exposed
• TopCoder 
• Algorithm in Nutshells 
• TopCoder 
• Introduction to Algorithms 
• Programming Pearl