# Amazon Interview Experience for SDE Internship | AmazeWoW 2020

Round 1 (Online Test): Online test was conducted on Mettl platform. The duration was for 1hr 30 min. It was webcam proctored and consisted of 28 MCQs and 2 coding questions. MCQs were based on data structures, predict output, C++, and algorithms.

Round 2: The interview started with “tell me about yourself”. After that, he asked coding questions.

1. Find the longest substring containing distinct characters.

Ex:

```Input: abbabcdd
Output: 4```

2. Given preorder and pre_LN that contains whether the node is leaf nodes or not,  construct a binary tree.

Ex:

```pre =  {1,2,45,3,5}  pre_LN={N, N, L, L, L}
Tree:
1
/   \
2     5
/   \
45      3
The interviewer was very keen on edge case handling.
For example, Function  should return null  if:
pre={1,2,3}   pre_LN={L, N, N}```

The duration was for 1 hour.

Round 3: The interview started with “tell me about yourself “.

1. A bag contains magic balls.  Each ball has a specific weight.  Every time, balls with two highest weight are removed (let the balls be X and Y) and collision which may or may not result in a new ball following the given constraints :

• Case 1: If X>Y then they result in a new ball of weight X-Y
• Case 2: If Y>X they result in a new ball of weight Y-X
• Case 3: X=Y No new ball
• Example: [2,4,6,8]
• Pick 6,8 – > New ball=2 -> Array becomes [2,4,2]
• Pick 4,2 -> New ball=2-> Array becomes [2,2]
• Pick 2,2 -> Array is empty -> return 0
• Example2:  [3,10,17]
• Pick 10,17 – > New ball=7 -> Array becomes [3,7]
• Pick 3,7 -> New ball=4-> Array becomes [4]

Since the array contains only 1 ball, return its weight -> return 4

2. There are n workers, each having some capacity. The workers are given rotis based on their capacity,  i.e workers with a higher rating will get a more number of rotis. A worker can only know the rotis and capacity of two of his neighbors, one on the left and other on the right. Given an array specifying the capacity of workers, find the minimum rotis that should be given for each worker,  so that no worker feels unfair.

Example:

```Input: 1 3 5 4 (ratings for 4 workers)
Output: 1+2+3+2 = 7```

Example:

```Input: 5 3 4 2 1 6
Output: 2+1+3+2+1+2 = 11.```
3. Since there was time left,  he asked ACID properties in DBMS and mutex, semaphores, deadlocks (operating system concepts).

The duration was for 1 hour.

Result: Selected

GeeksforGeeks has been very helpful for my preparation.  Thanks a lot!!

Write your Interview Experience or mail it to contribute@geeksforgeeks.org

My Personal Notes arrow_drop_up

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

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

Article Tags :
Practice Tags :

Be the First to upvote.

Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.