# Amazon Interview Experience (II)-Offcampus 2022

You might be thinking about (II) written in the title, it’s nothing just telling that it’s my second full-time interview at Amazon( after the 6-month cool-down period). This time is for the Prime Video team.

Work Exp- 11 months full-time SDE-1 + 6 month Internship

I applied through the Amazon career site for the **SDE-1 new grad** role.

**Online Assessment**

There were 2 questions, one is based on the **heap,** and the other is on **BFS**. I manage to solve both.

1.https://algo.monster/problems/amazon_oa_find_all_combination_of_numbers_sum_to_target2.https://leetcode.com/problems/sum-of-subarray-minimums/

Given an array of integers arr, find the sum of min(b), where b ranges over every (contiguous) subarray of arr. Since the answer may be large, return the answermodulo109 + 7.Example 1:Input:arr = [3,1,2,4]Output:17Explanation:

Subarrays are [3], [1], [2], [4], [3,1], [1,2], [2,4], [3,1,2], [1,2,4], [3,1,2,4].

Minimums are 3, 1, 2, 4, 1, 1, 2, 1, 1, 1.

Sum is 17.

Adding only coding questions as OA has some more assessments too(not coding). Iam able to solve both questions in time …and my interview was scheduled.

I had 2 Technical Round on the same day

**2. Technical Round 1 — By (SDE II + 1 shadower)**

Held in an Amazon chime. We both started with the introduction. I covered my education, work experience, and projects…

She started asking Leadership Principles questions:

1. Tell me about a time when you couldn’t meet your deadline?2. Tell me about a time you committed a mistake?3. Have you ever failed at something? What did you learn from it?How it’s impacted your project?

Then she quickly jumped to coding questions and first I have to explain the approach if she approved then move to code.

1. Given the String and have to partiton the given string such that all of the ocuurence of the character in the partition should be covered.Maximize the number of partition.Input: "abccaadee"output:2

1 partition : "abccaa"

2 partition : "dee"Explanation: all the occurence of character in "abccaa" is in tring itself. last occurence of 'a' is at 5th index. Same goes for every character.

Did using O(n^2) solution by maintaing the last occurence location of every character in map

PS: can be solved in O(n)

https://leetcode.com/problems/partition-labels/2. Similar to Rotten Oranges

https://leetcode.com/problems/rotting-oranges/

should be carefull with the edges cases here( I miss one edge case)First I started with DFS approach then move to BFS and coded

**3. Technical Round 2 — By SDE II**

Just after one hour, I had my second interview, and again with a small introduction. He explains little about the team and their project in **the prime video.**

He jumps to the coding questions then

1. Street parade is going on a narrow road which is having a lane attached to it? Ferries in the parade should come out from the lane in decided order but they all entered in the lane unordered. Lane is only wide enough for single ferry so they cannot overtake and once move forward they cannot take reverse? You need to find a way to organize ferries in its order? And if they can be ordered return true else return false?Example: 5, 1, 2, 4, 3Ouput: Trueexplanation: 5, 4 are not in order, pop them out and add in the list again.Example: 4, 1, 2, 5, 3Ouput :Falseexplanation: 4, 5 are not in order, pop them out and add in the list again. As in last it will not be in sequenceI told him the stack approach.I told him the stack approach.2. Print the zig-zag traversal order of binary tree?Correct Traversal:A -> B -> C -> G -> F -> E -> D

https://leetcode.com/problems/binary-tree-zigzag-level-order-traversal/I explain 2 stack approach and coded the same. He look satisfied

We had little time left so..now its time for mind bogglers

Here are the formality comes — >>> **Leadership Principles** questions 😬

1. Time when you were 75% through a project and realized you had the wrong goal.2. Time when your team members were not supporting something but you pushed and went for a more optimal solution.3.Time when you failed to meet your commitment

Last he ask if I had any questions and the interview ends here.

**4. Bar Raiser Round— By SDE III**

Started with our small introduction …He is not interested it seems, directly jumps to the coding questions

1. Searching in the rotated Sorted Array.Input :arr[] = {5, 6, 7, 8, 9, 10, 1, 2, 3};

key = 3Output :Found at indexWe discuss lot of edge cases.https://www.geeksforgeeks.org/search-an-element-in-a-sorted-and-pivoted-array/

He really is not in a good mood, He is not listening properly.

Then he asks one LP question: Tell me the situation where you worked on time constraints and how you handle the situation.

Waiting for the Interview result..🤞I will update you soon.By the time you can clap if you like and read my other interview experiences. **here**

You can connect with me: **here**