Amazon Interview | Set 59 (Off-campus for SDE-1)
I recently went through the Amazon interview process for the post of SDE-1. It was an amazing experience for me.
Online Round (2 hours):
Q1- Program to rotate a matrix by 90 degree clockwise.
F2F interview 1(45 minutes):
Q- Given a MXN matrix. To find the number of ways to reach the mth row and nth column cell from 0,0 cell. Find the same if some of the cells are marked as not reachable.
First implemented using recursion then through dynamic programming.
Q- Given a linked list like a1-a2-a3-a4-b1-b2-b3-b4. Convert it into a1-b1-a2-b2-a3-b3-a4-b4.
F2F Interview 2(50 minutes):
Q- Given a sorted array of 0 and 1. Find the first occurrence of 1. Production working code was required. I provided him O(logn) solution. He asked me how it is O(logn). Then I explained him and generated the formula for same. He was convinced finally.
Q- Implement the cache using LRU technique. Production working code was required.
F2F Interview 3(1.5 hours):
Discussion on my current project. He asked every minute details of my project and made me feel like he knows better than me about my project 😛
Then he asked me to implement a data structure for showing the currently visited items by a customer on any website. You will find the same on Amazon website at bottom left side.
Program to sort m sorted arrays. I told him that I knew this. So we moved ahead.
Data structure to push, pop and find min element in O(1) time.
F2F Interview 4(45 minutes):
Q- To delete all the nodes from a binary tree that lie on a path whose sum from root to leaf is less than a given value K. Twist was that the node values can be any integer. It may be a negative number.
He asked me to find the time complexity and space complexity.
I did it using recursion with O(n) time complexity and O(1) space complexity. He said that there is some space being used by my program that I am not taking into consideration. I got his point. Since I was doing it using recursion, So some internal stack space was being used and that would be O(logn)i.e height of tree. That was bit tricky.
Q- Given two sorted arrays. Find the median of the combined array.
One thing that you need to keep in mind is that you need to provide them the optimized solution with respect to time and space and don’t forget to consider the corner cases.
After 4 days I got a confirmation call from Amazon 🙂
Many Many congratulations to the author. If you like GeeksforGeeks and would like to contribute, you can also write an article and mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course. In case you are prepared, test your skills using TCS, Wipro, Amazon. Google , E-Litmus and Microsoft Test Serieses.