# Amazon Interview Experience for 6 months Intern (On-Campus)

Amazon conducted 3 rounds.

**Round 1: **An online assessment that consisted of 4 sections.

**Code Debug(20 mins):**It consisted of 6 questions. (Cakewalk)**Work Style assessment(25 mins):**Questions based on Amazon leadership principles**Coding(70 mins):**2 coding questions- Count unique pairs in an array that sum to a given target: https://www.geeksforgeeks.org/count-pairs-with-given-sum/
- Find if tree S is a subtree of another tree

**Logical ability(35 mins):**MCQ based aptitude questions

I was able to solve both the coding questions. 25 students were shortlisted for further rounds.

**Round 2: **Interview was held on Amazon Chime and LiveCode. The interviewer introduced himself and asked me for the same. After that, 2 coding questions were asked.

- Implement a LIFO data structure that has the following operations: Push, Pop, GetMiddle, DeleteMiddle.

I discussed the brute force approach using array along with the time complexities of all functions. Then, he told me to improve the time complexity of DeleteMiddle function. So, I told an approach to use HashMap. The interviewer said to make my own hashmap instead of relying on language. I was not able to come up with a solution. I was asked to code. - Pattern-based question:
1 11 21 1211 111221

I was not able to recognize the pattern.

**Round 3: **Interview was held on the same platform. I introduced myself. 3 coding questions were asked in this round.

- Given an integer array, find all the numbers which don’t have a greater element on its right.

I explained brute force solution and time complexity(TC: O(n^2), SC: O(1)). The interviewer asked to improve time complexity. I told an O(n) TC solution with O(n) space. We moved on to the next question. I coded the solution. - Given an array of stock prices, perform 2 queries.
- Change the value of the stock at ith index
- Find minimum stock price within a given range

I told brute force solution with O(1) and O(n) TC respectively. I was not able to tell the optimal solution for the second query.

- HOD of your college is supposed to give gifts to students.

Input Parameters: n(number of students), List of edges represting friends, k(cost of a gift)

If HOD gives gifts to student A, he will also have to give gifts to all the students whom A considers as his/her friend. If A considers B as his/her friend, it’s not necessary that B considers A as his/her friend. Find the minimum cost HOD will have to spend.

For example, if A’s friend is B and B’s friend is C, 3 gifts have to be given.

I told a solution based on DFS. I was asked to code. After explaining the code, he said there’s also an optimal approach. But, we were running out of time. So, he asked if I had any questions.

5 students were selected.

**Verdict: Rejected**

## Please

Loginto comment...