Amazon interview experience | Set 384 (On-Campus for FTE)
Online Coding Round:
Time: 1.5 hr
Questions Format: 20 MCQs + 2 Coding Questions
MCQs were based on Data Structures, OS, Networking, etc.
1)find maximum j-i such that arr[j]>arr[i]
Expected time complexity: O(n)
2)find maximum of minimum of every window size in the array
Only optimised solution(O(n)) using stack was able to pass all test cases.
Around 37 students were selected from the coding round and were called for further interview rounds.
Time: 45 minutes
The interviewer was very cool. She asked me to introduce myself and a brief introduction of the projects that I have done. Then she moved on to the data structures part.
One question was that given an array containing the equal number of positive and negative elements, arrange the array such that every positive element is followed by a negative element. I told her the O(n) approach by firstly segregating positive and negative elements with 0 as the pivot and then arranging alternatively. She asked me to write code for that covering all corner cases.
Second question was simple to reverse linked list in groups of given k size.
She asked me to write code for that.
Time: 45 minutes
The interviewer was very cool and cooperative. He asked me how my previous round went. Then he moved on to the questions.
One question was simple to find boundary traversal of binary tree.He asked me to write code for that.
Second question was find min cost path in matrix.I told him the approach using BFS then finally solved it using recursion with memoization. Then he asked to write my approach on paper. He was very impressed with my performance in this round.
Time: 60 minutes
The interviewer was the manager and head of the panelist. He asked me to introduce myself, what is my favorite subject. He asked me which question I had solved that I found to be hard and what were the problems that came while approaching that question. Then he moved on to the questions.
One question was given an n-ary tree, for every kth level of the tree, print the kth node present at that level on counting from left and if the kth node is not available, then print the last node at that level. I told him the obvious approach using level order traversal. He asked me to write code for that covering all corner cases.
Another question was to buy and sell stock only once.Then he changed the question to buying and selling multiple times to maximize final profit.He kept on confusing me by modifying the problem constraints.Then he finally accepted my solution and asked me to dry run on that code.
Time: 1.5 hr
This round was mainly based on problem-solving and various CS subjects like OS, DBMS, OOP, etc.He started the round by asking me to introduce about my project which was an android app.He asked me about the core idea of the app, its layout, etc. He asked me about what I had used for storing various information in the database and I told him that I used MySQL with MySQL statements called from a PHP script using URL encoding mechanism in java. He asked me about the difficulties that I faced during my project and how I had tackled those problems. Then he moved on to the questions.
The statement of one question was similar to the mobile-keypad problem.But there was a slight variation that a dictionary of words was also given along with a number and I had to find all words which are present in a dictionary that can be obtained by pressing this number. I told him the usual approach using backtracking. He asked me to optimize my approach. He gave me a hint that it could be done by using some spaces. Finally I came to the optimized solution by mapping individual letters with digits from which they can be generated by pressing the digit like pressing 2 can generate letters a,b or c so map a,b, and c with 2.Then iterate over every word present in dictionary to find if it is the possible solution or not.
Second question was to find next higher element in an array for every element.I told him the brute-force one of O(n^2) time complexity. He asked me to optimize that. I tried it using BST but it was not passing all test cases. Then after some hints, I finally came to the solution using the stack.
He asked me to design a class for the tic-tac-toe game where the size of the board given is variable n. I was asked to implement the member function findWin() by checking all rows, columns, and diagonals for all 1s or all 0s for any matrix size n.
He asked me questions based on OOP like an abstract class, interface, their differences, etc. and in OS, he asked me about mutex, semaphore, their differences, etc and describe the software life-cycle in detail. Finally, the round ended.
9 students went in the 4th round of which 5 were selected. I was one of them. 🙂
I thanks GeeksforGeeks for helping me in my preparations.
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. 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.