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

• Difficulty Level : Hard
• Last Updated : 28 Jun, 2019

Recently, Amazon visited our campus. Here is my Interview Experience:
Online Round: (Duration – 90 minutes)
20 MCQs and 2 coding questions. MCQs were on Algorithms, Time Complexity, Quantitative Aptitude, Probability, Operating Systems, Graphs, Data Structures, Recursion outputs etc.

Coding Questions:

1. In one of Amazon fulfilment centres, there are a no. of empty boxes kept in increasing order in a row. Kiva robots are designed to put a product in a box. The product size is given. Design a program to find the best fit box for given product size. First line contains no. of empty boxes and next line contains size of boxes with space. The next line contains size of given product. The output shows the best fit box size and -1 otherwise.

```For example, Input: 6
2 7 9 11 13 16
12
Output: 13 ```

ROUND 2: (DS CODING ROUND)
1. Given a BST and 2 nodes in the BST, find the length of the path between the two given nodes.
Example:
Input: the below tree and node 3 & 7
Output: 5

ROUND 3: (F2F)
1. Given an array where the elements are in absolute difference 1, write an algorithm to search for an element in the array and return the position of the element. (return the first occurrence).

```Example:
Input:  8 7 6 7 6 5 4 3 2 3 4 3     search element: 3
Output: 7```
```Example:

3. It was a scenario question based on facebook. I have to find all the mutual friends of my friends and my friends of friends of friends. This list returned should be in a sorted order. To perform the above action u are given a getfriend() function which will return the list of friends for that id.
Hint: use hashing

ROUND 4: (F2F)
1. It is a graph question. A 2D graph with x and y coordinates. Given millions of points in a graph, find the k nearest point to the origin.
Hint: use heap ( I used a priority queue )

```Input:
given node – F
K=2
Output: A E J K L```

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.

My Personal Notes arrow_drop_up