# Amazon Interview Experience | Set 155 (On-Campus)

Recently Amazon came to our campus as a part of our campus recruitment.

**Online Round:**

1) Given a linked list of zeros and ones, sort the list.

2) You are given three numbers. Each number is represented by a linked list. Write a function that returns sum list.

Example: 1->2->3 + 2->1->3 + 3->2->1 = 6->5->7.

This was conducted on hacker rank. Test duration was 1.5 hrs

There were around 22 MCQs related to OS, OOPs C Input/Output questions. GeeksQuiz is sufficient to answer these questions.

They shortlisted 25 people for the interviews.

There were 4 technical rounds in total. Every round is an elimination round. In each round interviewer asks you to explain the algorithm as well as implement it on the paper.

**First Round:**

Started off with a basic “Tell me about yourself” question. This round is just to check if you really are capable. He asked me three questions and asked me to implement all of them on paper.

1) You are given an array and a number c. Output all pairs a, b whose sum is equal to c. O(n) is expected.

2) You are given a number represented by a linked list add one to it.

I told him the obvious reversing the list and add one to it. But he wanted me to do it without reversing and using recursion.

3) You are given a sorted array, find majority element in it. If there is no such element output -1. You have to do it in single o(logn) operation.

Extension to the third question: What if the array is not sorted? Provide an o(n) solution.

**Second round:**

This was for about 2 hours. Although there were only two questions but the interviewer is checking if we have enough knowledge on all the data structures.

1) You are given a long array and window size w. You can only view elements that are currently in the window. Window starts at the extreme left and moves one position at a time to the right. You are required to output minimum numbers in the current window.

All the possible approaches were discussed. Starting from brute force, o(nw) to o(nlogw) using heaps, BSTs. He asked me to implement them. But he was not satisfied with o(nlogw) solution. He wanted me to give a o(n) solution. Finally after few hints I’ve solved it using doubly linked lists.

2) You are given a binary tree. Print the vertical order traversal starting from the root element.

**Third Round:**

Started off with the question “Explain one project of yours”. Few technical questions were asked on the project.

Few questions on OS, Multithreading vs Multiprocessing were asked. Also he asked me to tell if I have implemented any program that used multi threading. Few questions on semaphores and mutexes were asked.

Only one coding question in this round

1) You are given a very large binary tree, return the root node of the largest BST in the given tree. Single traversal solution is expected. Implementing it on paper was little difficult than expected.

**Fourth Round:**

By this time, job offer was almost confirm.

He asked questions on my projects. He asked me to implement few algorithms from my project on a paper.

1) Implement a graph and one graph traversal using oops.

2) Given an immutable(non editable) linked list and a number k, remove all occurrences of the number in the list.

Few questions on OOPs were asked.

They gave me the result after 20 minutes 😀

I would like to thank geeksforgeeks which helped me enormously in getting placed.

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

## Related Practice Problems

## Recommended Posts:

- UHG Interview Experience | OnCampus- 2019
- ServiceNow Interview Experience Oncampus
- MathWorks Interview Experience (EDG, Oncampus)
- InfoEdge Interview Experience | OnCampus-2019
- Amazon Interview Experience | Set 167 (SDE I for 1 year 6 months experience)
- Amazon Interview Experience | 401 (3+Years Experience for SDE II)
- Amazon Interview Experience | Set 243 (2.5 Years Experience)
- Amazon Interview Experience | Set 242 (1 Year Experience)
- Amazon Interview Experience | Set 241 (1.5 years experience)
- Amazon Interview Experience | Set 391 (SDE-2, 5.5 years Experience)
- Amazon Interview Experience (For Experience - 2.8 yrs) | SDE 1
- Amazon Interview Experience | Set 248 (4.8 Yrs Experience for SDE II)
- Amazon Interview Experience
- Amazon interview Experience | Set 409 (For SDE-I)
- Amazon Interview Experience | Set 434 (For SDE-2)