Amazon visited our university (Thapar Institute) for hiring interns (6 Months internship) in the month of September 2020. The entire process was virtual due to the COVID pandemic. There was no CGPA cut. Branches allowed were – CS, ENC, ECE, EIC, and EE. Around 600 students gave the test.
1st Round (Online Test): The test consists of four sections.
Code debugging section (20 minutes): 7 questions were there. We had to find the logical error in the given code snippet and to correct the same. This section was easy.
Coding test (70 minutes): 2 coding questions were asked and everyone had a different set of questions.
Workstyles assessment (20 minutes): These were some behavioral questions.
Reasoning ability section (35 minutes): Around 24-25 MCQs were there – Aptitude, Paragraph based Questions, Reasoning Questions.
After the test, 70 students were shortlisted for interviews.
2nd Round F2F Interview on Amazon Chime(1 Hour Long): The interviewer went through my resume. Then, he directly jumped to coding questions. I was asked two questions in this round, and he wants me to write the code for the same on their own coding portal.
- For an N-ary tree, print its apex. Apex is defined as the first and the last element at each level. Firstly he asked to code the function part only. Then, he asked me to write the full code that is to write the main function also.
- For a string prints its previous lexicographic permutation. I wrote the code for this, and then he asked me for some optimizations in some parts of the code. In the end, he asked me if I have any questions.
About 60%-65% of the students made it to the second interview.
3rd Round F2F Interview on Amazon Chime(40-45 Minutes Long): The interviewer went through my resume. Then, he directly jumped to coding questions. I was asked two questions in this round.
Given a tree-like:
1 / \ 2 3 / \ / \ 4 5 6 7 / \ / \ 8 9 10 11
Where the elements are continuous integers starting from 1. All the levels except the last one are completely filled. I have to check whether a given element exists in the tree or not.
- First I gave the approach for comparing each and every node with the given value using recursion. Time complexity – O(n).
- He then asked me to optimize the solution (Expected time complexity – O(log n).
- I came up with the approach that we can check for the left-most node at each level as it is always a power of 2. But this didn’t work out.
- Then, I saw there is a relation that children of a node ‘i’ are – 2*i and 2*i+1 and for every node ‘i’, its parent is i/2. So, if I want to search for 11, then I will start from 11 -> parent of 11 will be 5(11/2) -> parent of 5 will be 2(5/2) -> parent of 2 will be 1(2/2). So, I have to just traverse the path 1->2->5->11.
- Then, I wrote the code for this approach and the interviewer was satisfied with the code.
In the above tree, I have to find the maximum value present in the tree.
He asked to use the above approach for this question. So, I came up with this approach-
The maximum value node will always be present in the last level. So, the answer will lie in the range – 2^level to 2^(level+1)-1. So, then apply binary search in this range and check whether the mid-value exists or not. Time complexity log n * log n.
In the end, he asked me if I have any questions. This interview ended.
The results came the next day in the morning. A total of 17 students were selected for an internship, and I was one of them :-).
I would like to thank Geeksforgeeks which really helped me a lot with the interviews.
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course. In case you are prepared, test your skills using TCS, Wipro, Amazon and Microsoft Test Serieses.