Amazon SDE 2 Inerview experience
Company: Amazon
Role: SDE II
Interview Stage: Onsite
Location: unknown
Year: unknown
Original Post Content:
Round 0 : OA
There were two easy problems on Hackerrank and few behavioral as well as tradeoffs based question. Was able to solve both the questions and gave answers to tradeoffs as per my understanding. Got the mail from recruiter that I have cleared the online round and they asked my availability for the loop interviews. A total of 4 rounds were set up.
Round 1: LLD
This was an LLD round where I had to design a system for handling delete requests for Alexa. The system had to handle deletion for various domains such as deleting music library, verbal tasks, file storage, etc. I was not asked to write the code but had to present the class diagram. I started with Chain of Responsibility pattern to which the interviewer hinted that it would be a wrong pattern as there is no particular order in which we have to delete data from respective domains. She hinted to think of something such that whenever a delete request comes in the system sends this info to other domains and they handle their respective deletion. Immediately understood that it would be based on Observer pattern and gave her the class diagram. It was a one hour round and in the last 30 minutes there were some LP based questions. When I asked for feedback at the end she told me don't focus on using a specific design pattern, come up with a solution first.
Round 2: HLD Round (Bar raiser)
Was asked to design a BookMyShow like ticket booking system. Had solved this problem earlier, so after gathering FR and NFR I was able to quickly give a design, few questions around tradeoffs were asked which I was able to answer. First 30 minutes was LP questions and last 30 minutes was this design question. Went well according to me.
Round 3: Coding Round
First 20-25 minutes was again LP questions. Then I was asked a question where given a few translators and language known by them, and a source language and a destination language, give a sequence of translators that can be used to convert source language to destination language. Solved the problem using DFS. However, the structure I used to store the graph was Map<String, Map<String, List<String>>> where the first key is language 1, second key inside the second map is language 2, and the list contains the translators which happen to know both language 1 and language 2. I was asked why I am not using BFS to which I told DFS is more comfortable to me and given the time limit to write the code I am more confident in DFS. Had given the most optimal approach with O(L+E) where L is the distinct number of languages and E will be the edges in our graph.
Follow up question was if each translator had an associated cost, how would I find the cheapest conversion. First I told we can use Dijkstra but immediately noticed that in my solution at each DFS, for converting language 1 to language 2 we can greedily choose the cheapest translator. The interviewer looked satisfied.
Round 4: Coding Round
No LP questions in this round. First I was asked to give a solution to find the square root of a number, in integer value, for example, sqrt of 8 would return 2. Initially gave the solution with sqrt(n) complexity, interviewer asked me to optimize it to which I gave the binary search solution. My solution was not handling the case where n=1 and then I adjusted it to get the right answer for all numbers. Second was similar to "A game of life" LeetCode question. Was able to give correct solution without using extra space and code it in time.
Result: Got the rejection mail 3 days later. Called the interviewer to get the feedback which was as such:
Round 1 : Taken incorrect approach with Chain of Responsibility pattern. Interviewer had to give hints.
Round 2 was fine
Round 3: Used complex data structure to store the graph. Also was not confident in giving BFS solution.
Round 4 : Missed edge cases for the square root problem