Amazon came to my campus in the last week of July, 2017.
The online round was hosted on HackerEarth platform.
It had 2 coding questions and 20 MCQs.
Q1. Given an unsorted array A, find the largest value of i-j such that A[i]>A[j].
Q2. Given an unsorted array A and a number k, find the maximum sum sub string in the array such that its sum is divisible by k.
1 mark each and 0.25 negative mark.
Few MCQs were based on data Structures, algorithms, oops and operating Systems, 1 or 2 from logical reasoning, networking and DBMS each.
Every interview round started with the cliche “tell me about yourself” and ended with “do you have any questions”.
Design Question : Given a log file with product id and corresponding customer id for the products searched on amazon, you need to find the most viewed product at the end of the day. If a product is viewed multiple times by a single customer its view count is increased only by 1. Number of products are very large so sorting, heap or hashing of product Ids is not feasible.
Solution- Use Trie data structure. After 10 minutes of discussion I could come up this.
Production level code for insert and search in a trie was required.
What if k max viewed products were required.
During my discussion he also asked me to write a hashing function.
Dfs of a graph.
Dfs of a n array tree. (Code was required)
- Given a string s and a file with each word on a separate line, find all the words in the file which are anagrams of the string s. The interviewer asked me tell all the possible solutions irrespective of the complexity. This continued for 10 min.
- Given a m*n matrix find number of paths from (0,0) to (m-1,n-1), at every block we either move 1 step down or 1 step right.
- Print all paths for the above questions. A dp solution was required.
- Given a n*n matrix with distinct elements from from 1 to n^2, find minimum number of bombs required to destroy all cells of the matrix. If we bomb a cell with value i, a cell with value i-1 if 4 adjacent to it will also be destroyed. (Code was required)
What if the the numbers were not unique.
Find majority element in an unsorted array.
Find majority element in sorted array. (logN solution was required)
- Print the elements of a tree diagonally.
- Find shortest distance between two nodes of a tree where every node also has a pointer to its parent node and we can also directly jump from a node a to node b, where b is the mirror image of a and a and b belong to the two sub trees rooted at the root of the given tree. The mirror image may or may not exist.
- Find the time required to pass information from root to all the nodes of the tree. Link
The interviewer then asked me which other non coding subject do I like. I said os.
So he asked me several basic questions on OS.
- bdady anamoly
- page fault
- multi processing
- difference between threading and multiprocessing
- scheduling algorithms
The famous Amazon’s Bar Raiser Round
My internship experiences.
Detail discussion about my summer internship project.
What is your favorite algorithm and why.
Toughest thing you did in college.
What are some leadership principles you learnt during your summer internship.
What was the non technical thing you learnt at your internship.
This was a telephonic round and went on for 34 minutes.
I recommend every one to prepare from InterviewBit, Hackerearth CodeMonk, Hackerrank, http://blog.gainlo.co/index.php/category/system-design-interview-questions/, https://ashayraut.wordpress.com/interview-preparation-best-100/ and geeksforgeeks.
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.