# Amazon Interview Experience for SDE-1

I have applied for the position of SDE-1 in Amazon India through a referral of an Amazon Employee. ** **

**Round 1: **(Written Round) This round comprises of 20 MCQs on different topics and 2 coding questions to be solved in 90 minutes. Most of the MCQs are from data structures & operating system. The questions were easy. The coding questions are as follows:

- https://leetcode.com/problems/course-schedule/
- https://leetcode.com/problems/reverse-string-ii/

I was able to solve both the problems and most of the MCQs.

**Round 2: **(Technical Interview 1, **1 hour**) This round begins with the introduction followed by **3 data structures and algorithmic problems** to be solved with pen & paper. Here I would suggest you ask questions if you have doubt about the problem. When you are stuck, the interviewer will probably give hints. If they ask you to write the code, you are on the correct path. I was stuck 2 or 3 times in the interview but able to solve all the problems. The problems were as follows:

- https://www.geeksforgeeks.org/convert-array-into-zig-zag-fashion/
- https://www.geeksforgeeks.org/bottom-view-binary-tree/. After writing the code, the interviewer asked me to print top or bottom view of the tree according to the user’s choice without changing too much code.
- www.geeksforgeeks.org/sliding-window-maximum-maximum-of-all-subarrays-of-size-k/

It is a good thing if you have heard the question already. But I would suggest thinking on your own instead of remembering the solution in case you forgot the solution. Don’t panic at all. Try to solve the problem as if you haven’t heard it at all before.

**Round 3: **(Technical Interview 2, **1 hour**) The interviewer was a little experienced. In this round, the interviewer discussed the **projects** I have written on my resume. Please mention only those projects that you can explain. I only wrote 3 projects. He asked me to choose 1 and explain. While I was explaining, there are some questions interviewer asked. I gave him a satisfactory reply. This is more like a discussion. This discussion was of around 20 minutes. Then there is a 5-minute discussion on my** internship** followed by a simple algorithmic problem.

www.geeksforgeeks.org/find-minimum-element-in-a-sorted-and-rotated-array/

After this, there is a 20-25 minute discussion on designing an optimal data structure for two types of queries.

- Inserting a post office in a data structure. Details of the post office are in order:
**Country, State, City, Town, Post office Name**. This order is always the same. - Printing all the post office in the given region. The region may only involve a country or a combination of country and state, etc. But remember for any state, the country will always be given. For any town, Country, State, and City are given.

Here, ask the questions to the interviewer. The problem statement is a little vague in this case. It involves **hierarchy.** So, anyone would have come with a solution of the tree. But remember, the solution is how to store the tree. The adjacency list is not a good option here. Notice that the number of level in the tree is fixed. So, here we can store **each level as a hash map or BST**. The hash map is obviously better but as I have said BST as a solution. There was a discussion on BST too. So, BST was good in terms of worst time complexity while the hash map is good at average time complexity. There was a little more discussion as I was in doubt how to modify Data structure if there is one more level. But after the discussion, I got it. In the end, the interviewer said that it was a good brainstorming session.

**Round 4: **(Technical Interview 3, **1 hour**) This round again begins with the **project discussion**. I explained to him the same project that I explained in previous interviews. But I faced some new questions regarding the project in this interview. Then he comes up with a data structure problem. I have given the solution to him but he stopped me to write the code when I told him the problem is very similar to the problem from the first round. However, the problem was:

https://www.geeksforgeeks.org/print-binary-tree-vertical-order-set-2/amp/

Then, he asked one problem again:

www.geeksforgeeks.org/find-the-largest-subarray-with-0-sum/

Here I came up with the solution that involves two traversals of the array. The time complexity is, however, O(n). But he asked me to solve the problem in 1 traversal. At that point of time, I was not able to come up with the approach. So, he asked me to write the code. While writing the code, I came up with the solution in a single traversal. I told him the approach. Then again he asks some questions regarding the solution. Basically, these questions tell you where you are wrong and you are expected to correct your solution.

After this, he asked whether I know DBMS. I told that I learned it in my 2nd year. So, not very confident about it. But, I added that you can ask me the questions. He asked some questions related to transactions which lead to the discussion of **deadlocks and critical section**. The critical section and deadlock problems are basically in the Operating System. He gave me some situation. I solved all those problems using **semaphores.**

Problems:

- How to manage the critical section if two processes try to access that part. This can be solved using one semaphore. He further asked what if there are more than two processes. The answer is still the same.
- He asked how to get and update the value in array at a particular index can be handled if more than one process tries to update and get the value at the indices. Here we would need n number of semaphores. One semaphore for each index.
- He further asked what will happen if we use the same set of semaphores for update and get. The answer was we can not get and update the same index at the same time. He also asked what will happen if we use the different set of semaphores for update and get. The answer was we may get ambiguous values if we update and get at the same time.

These technical interviews were onsite. After this, the final (Bar Raiser) round is to be held on the telephone. This interview held after a month.

**Round 5: **(Bar Raiser Round, **35 mins**): This round starts with a simple introduction followed by some discussion on my internship. The collab edit link was shared with me. He asked me to solve a coding problem on the editor. I tell him the approach for the problem which was not fully correct but he was satisfied with the solution. Sometimes, it is more about your approach instead of correctness. So, being confident always helps. The problem was:

Given some equations involving the division of single-character variables like a/b = 2.3 b/c= 3… etc, find the value of expressions like a/a, b/a etc. Answer – 1 if no solution exists. The problem can be solved using a directed graph where nodes are alphabets and edge u->v gives the value of u/v. So, expressions can be solved by traversing from one node to another multiplying all the edges in the path. Find the edge cases and ask the questions to the interviewer whenever the question is not clear.

In all the interviews, in the end, the interviewer will ask you to ask any question if any. Ask some good questions.

## Recommended Posts:

- Amazon Interview Experience | Set 258 (For SDE1)
- Amazon Interview Experience | Set 186 (For SDE1)
- Amazon Interview Experience SDE1
- Amazon Interview Experience | Set 281 (for SDE1)
- Amazon Interview Experience | Set 187 (For SDE1)
- Amazon Interview Experience | Set 185 (For SDE1)
- Amazon Interview Experience | 198 (For SDE1)
- Amazon interview Experience | Set 141 (For SDE1)
- Amazon Interview Experience | Set 261 (For SDE1)
- Amazon Interview Experience | Set 262 (For SDE1)
- Amazon Interview Experience | Set 153 (For SDE1)
- Amazon Interview Experience SDE1
- Amazon Interview Experience | Set 188 (For SDE1)
- Amazon Interview Experience for SDE1
- Amazon Interview Experience SDE1 | Off-campus

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.