Open In App

# Amazon Interview | Set 117 (On-Campus for Internship)

Recently Amazon India visited our campus for 2 months internship. There were four rounds.

2 online coding questions + 20 MCQ :
MCQs had 15 questions(not exactly) on OS (to my surprise) , one aptitude(probability) and rest on c/c++

2nd Round ( Group Interview / Written round) :
21 were selected for the second round. We had 2 questions.

2. Given a n-ary tree, Convert it into an array and return it. Construct the same n-ary tree from that array again. (DFS is better here as reconstruction is necessary) –

Push the root to a stack. “pop the stack.store the value of the root node and the number of children it has in the array.push all the children to a stack from right to left”.. do this until the stack becomes empty.. the array will have dfs along with the number of children of each node.

For reconstruction,pass “i” by reference( i is for iterating through the array) take the value at index 0 .. make it has root. increment i. for all the children of the root, recursively call the same function. return root. (I hope this works :P)

3rd round (Face to Face):
Only 5 were selected.I was asked only one question and i didnt do well. Find the square root of a number. i answered that this can be done using Babylonian method. (https://www.geeksforgeeks.org/square-root-of-a-perfect-square/) or binary search method.. He asked me to implement Binary Search method. I did a mistake. then he asked me to correct it.. i corrected it. I wasn’t able to impress him much.

Remember the floating point arithmetic limitations.. this is where i failed.

4th round (Face to Face):
I was called for 4th round. ( Only i had 4th round because of my bad performance in the 3rd round). The interviewer asked a lot of questions. They were easy

1.Given an array of 0s and 1s sorted. Find the first occurrence of 1 ( Binary Search)

3. Given a matrix sorted in ascending order both row and column wise. Search an element. This is O(n+m). He asked me a better solution.. I tried and he helped me a lot..Though i wasn’t able to deliver.

4. Given a tree, print the max sum path from root to leaf.
5.Given a tree,print spirally the column order of a tree.

```ex :               1
/         \
2            3
/   \        /    \
4      5      6      7
o/p : 4 2 6 5 1 3 7```

6. Implement a stack using array. Implement two stacks using an array. Implement 3 stacks.

7. You are given an array . You have to create a stack when the user wants to do so and delete a stack when the user says.You wont be given the number of stacks that will be created.

I thank geeksforgeeks for providing an excellent platform to learn new things. Check the interview corner for other company interviews.

If you like GeeksforGeeks and would like to contribute, you can also write an article and mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.