# Amazon Interview Experience for SDE-1 (1 year Experienced)

Last Updated : 24 Nov, 2020

I got this opportunity during the COVID time and hence all the interview rounds were conducted on Amazon Chime (video call) and I had to write the code on LiveCode (a shared IDE) which was visible to both me and the interviewer.

First-round (Online Test)

• There is a matrix containing 0,1 and 9. You need to start from the top left and reach the cell containing â€˜9â€™. There is only one such cell containing 9.  You can move on to the cell containing â€˜0â€™. A cell containing â€˜1â€™ is an obstacle and you have one jump which you can use to cross the obstacle. We need to find the minimum number of steps required to reach the cell containing â€˜9â€™ from the top left of the matrix. (I applied BFS and it worked for me)
• There is a list of Amazon orders, with each of them being represented by a string. Each of the strings was of the format â€˜XXX YYY ZZZâ€™. We need to sort these based on a few priority conditions.
Solution: I used the sort function of C++ STL and wrote a custom comparator function)

Second Round:

• Given an input string and q number of operations that need to be performed on it. There are three types of operations.
1 â€“ reverse the string
2 1 a – insert the input character (here â€˜aâ€™) in the front of the current string
2 2 a – insert the input character (here â€˜aâ€™) in the back of the current string

Solution: Firstly I gave the approach using a doubly-linked list, but he wanted to use the same string variable to perform operations instead of making a DLL. As the insertion in the front on the string is a costly operation, so we can keep the front insertions in a vector and when all the operations are completed we can then make a string out of those characters and add a prefix to the current string in which all the reverse operations and insertions at the back has been performed.

Also we need to maintain a â€˜flagâ€™ which is toggled based on the reverse operation (as soon as there is an operation of type â€˜1â€™ (reverse), toggle the value of flag)

* Case 1: flag == false
– front operation: needs to be added to the front_vector
– back insertions: insert the character at the back of the original string (concatenation)

* Case 2: flag == true
– front operation: insert the character at the back of the original string (concatenation)
– back insertions: needs to be added to the front_vector

Also, before generating the final string, you need to check if the flag is true means the string is reversed, so based on that you need to generate the output string ( I missed this case, when the interviewer pointed out I incorporated this).

Dry Run Example:

abc -> input string( lets say â€˜sâ€™)
5 -> number of operations

1     ->    s = abc ( front_vector {}, flag= true)
2 2 a     ->    s = abc ( front_vector {a}, flag= true)
2 1 b     ->    s = abcb ( front_vector {a}, flag= true)
1     ->    s = abcb ( front_vector {a}, flag= false)
2 1 x     ->    s = abcb ( front_vector {x,a}, flag= false)

Front insertion string: xa
Output (Final string): xaabcb

• https://www.geeksforgeeks.org/find-the-farthest-smaller-number-in-the-right-side/

This round went for around 1.25 hours and I solved both the questions.

Third Round:

This round went for around 1 hour and I solved both the questions.

Fourth Round (Hiring Manager):

• Started with an introduction and then moved on to a detailed discussion about the project with my current employer which included
• What was my role?
• What components did I work upon?
• How were the components tested?
• What was the size of the user base?
• How were the bugs reported and handled
• Behavioral Questions:
• Tell me a situation where you worked on a tight deadline
• Tell me a situation where you took a decision
• Tell me a situation where you worked for a client requirement and delivered it within the deadline.

This round went for around 1.25 hours and for the behavioral questions you need to follow the STAR (S – situation, T â€“ task, A â€“ action, R – result) method.

Fifth Round (Senior Dev Manager):

• Started with an introduction, a brief discussion about the project with the current employer
• Anagram (https://www.geeksforgeeks.org/check-whether-two-strings-are-anagram-of-each-other/).  I solved the question quickly but there were few exceptional  cases which can be handled and this will reduce the complexity for them. As the interviewer pointed out the cases, I incorporated the changes in the code, and he was satisfied.
• Behavioral Questions:
• Tell me a situation where you worked on a tight deadline
• Tell me a situation where you went out of your comfort zone to learn and delivered something.

This round went for around 45 minutes.

Verdict:  Selected ðŸ™‚

Tips:

Previous
Next