Related Articles

# Amazon Interview Experience | On Campus for Internship

• Last Updated : 26 Aug, 2019

Hello Geeks, recently Amazon visited our campus for Internship and Full time and I appeared for the Internship Interview of Amazon.
What my personal experience says is that explore the problem first and then think progressively about possible solutions. Once the efficient the approach hits you, think whether its possible to further optimize it or not, instead of trying to jump to right solution straight away.
Check for all the corner cases and most importantly don’t remain completely blank during your conversation with the Interviewer but keep on telling the tentative solutions that are coming to your mind.

My entire process consisted of 2 rounds

1. Online Round
2. F2F Interview

Online Round:
Our online round was quite different than usual pattern followed by Amazon. We had three sections.
Section 1: 7 code debugging MCQs which were quite simple and required basic knowledge of any programming language but the constraint was only the time limit (10 minutes) and there was no negative marking.
Section 2: 24 MCQs based on aptitude and quantitative reasoning. They were also pretty easy with  no negative marking and time limit of 35 minutes.
Section 3: 2 coding questions and time limit 45 minutes.
Question 1: Search in a row wise and column wise sorted 2D matrix

```Input : mat[4][4] = { {10, 20, 30, 40},
{15, 25, 35, 45},
{27, 29, 37, 48},
{32, 33, 39, 50}}
x = 29
Output : Found at (2, 1)
Input : mat[4][4] = {{10, 20, 30, 40},
{15, 25, 35, 45},
{27, 29, 37, 48},
{32, 33, 39, 50}}
x = 100
```

Question 2: Round Robin Scheduling with different arrival times
You had to return the average waiting time for CPU to complete processing of all n processes.
(Processes were sorted according to Arrival time.)

```Input: arrivalTime[] = { 0, 1, 2, 3 }
burstTime[] = { 10, 4, 5, 3 }
quntumTime = 3
Output: Average waiting time is 10.0
Input: arrivalTime[] = { 0, 5, 7, 11 }
burstTime[] = { 10, 7, 1, 9 }
quntumTime = 4
Output: Average waiting time is 6.75
```

The three sections were followed by a feedback form which was a sort of HR round. This feedback too had a contribution in shortlisting students. So, I recommend to be concerned and a bit fair while telling about yourself through those feedbacks..

Face to Face Interview:
The Interviewer asked me to introduce myself. Then he asked few questions based on my CV and questions of CS core subjects like OS, DBMS, Computer Networking and concepts of OOPs. Then he asked me 3 questions of data structures and Algorithms.

Question 1Check if two nodes are cousins in a Binary Tree
He asked me to write code in O(n) and traverse tree only once. You need to consider that case too when one or both of the given nodes is/are not there in tree.

Question 2: Given a sorted array where all elements are repeated twice and only one element is present once. You are required to find that unique element.
The instant approach that striked me was returning xor of all elements. This was O(n) approach. He asked me to optimize it.
Then I gave O(logn) solution based on modified binary search.

Question 3: In a 2D array of integer, 2 denotes wall, 1 denotes zombie and 0 denotes human. Next day zombies turn adjacent human beings into zombies. A zombie is adjacent to the human one block above, below, left and right. Zombie cannot cross a wall.
Find out how many days does it take to infect all human. If some human never get infected, return -1.

```Input 1: mat[4][5]={{2, 1, 0, 0, 0},
{2, 0, 2, 2, 0},
{1, 2, 0, 0, 0},
{0, 2, 0, 0, 0}}
Output: 8
Explanation:
Day 1: {0, 2}, {1, 1}, {3, 0}
Day 2: {0, 3}
Day 3: {0, 4}
Day 4: {1, 4}
Day 5: {2, 4}
Day 6: {2, 3}, {3, 4}
Day 7: {2, 2}, {3, 3}
Day 8: {3, 2}

Input 2: mat[3][4]={{2, 0, 0, 0},
{2, 2, 1, 0},
{0, 0, 2, 2}}
Output: -1
Explanation: {2, 0} and {2, 1} never gets infected.
```

Approach: First scan whole matrix and store position of all zombies in a queue. All these elements in queue represent level 1. and now apply bfs over that queue and for each level increment count of days by 1. After applying BFS, if there is no human left, return count of days, else return -1 as all humans cannot be converted to zombies.

`Code Link:https://ide.geeksforgeeks.org/M8HPFwNxRI`

Then he asked me if I had any questions. I asked him about the type of projects we have to do there and how these data structures and algorithms and OS, DBMS subject’s knowledge are applied in real scenarios in handling their millions of users efficiently. He gave example of their recent change in data organisation with trees and started elaborating entire-work process at Amazon…some of which I could hardly understand.
I was finally hired for the Internship at Amazon. I would like to thanks Geeks for Geeks which helped me a lot in my preparation.

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, AmazonGoogle and Microsoft Test Serieses.

My Personal Notes arrow_drop_up