Amazon | SDE1 | Hyderabad | November'19 [Reject]
Summary
I interviewed for an SDE1 position at Amazon in Hyderabad in November'19. The process involved an online test followed by four interview rounds, covering data structures, algorithms, system design, and conceptual knowledge, ultimately resulting in a rejection.
Full Experience
I interviewed for an SDE1 position at Amazon in Hyderabad in November'19. I have 6 months of experience.
A recruiter reached out to me for the SDE1 role, and about a month later, I received an online test link on Hackerearth. It consisted of 15 MCQs and 2 coding questions.
Online Test
- 15 MCQs
- 2 coding questions: one was a topological sort problem, and the other was an adhoc problem on strings.
Interview Process
All rounds were elimination rounds.
1st Round
I was asked two algorithmic questions:
- First, a problem similar to Longest Substring Without Repeating Characters.
- The second problem involved a matrix where each row initially contained vowels and then consonants. I had to find the row with the maximum number of vowels. I initially proposed an O(mn) approach, then optimized it to O(mlogn), and finally to O(m+n).
2nd Round
The interviewer started by asking about one of my projects. Then, I was given one coding question: "Given a Doubly Linked List (DLL), convert it to a balanced BST in-place." This was described as similar to Convert Sorted List to Binary Search Tree but for a DLL. I came up with an O(nlogn) approach. The interviewer asked for the complexity and took about 5 minutes to understand my code, confirming it would work. I did forget to add a line I had previously mentioned in my approach, which I corrected after the interviewer pointed it out.
3rd Round
This was the longest round, lasting about 1 hour 30 minutes. The interviewer started by extensively asking about all the projects on my resume. Then, he grilled me on Operating System (OS) concepts like caching, paging, disadvantages of caching, dependency injection, and how to prevent dependency injection without Spring Boot. This discussion lasted around 45 minutes.
While explaining caching, I mentioned LRU cache, and he immediately asked me to write the code for it, referencing LRU Cache. I implemented it using a HashMap and a Doubly Linked List with dummy nodes, including all helper functions. It took some time to explain the code, especially the dummy nodes concept, as he was not familiar with it. He then made me dry run the entire code with an example.
By then, 1 hour 15 minutes had passed. The interviewer then gave me another problem but, due to time constraints, only asked for the approach: "Given a binary tree, store it in a database and then retrieve it in the same structure." I suggested converting it to a string using BFS/DFS for storage and retrieval. He extended it to an N-ary tree, and I proposed storing the size of children for each node during string conversion. He seemed satisfied.
4th Round (Bar Raiser)
The first problem was: "Given N balls where each ball has a different weight, combine them into a single ball by taking 2 balls at a time. The cost of each step is the sum of the weights of the balls you are combining. Minimize this cost." Only the approach was required, and I suggested using a min-heap.
Following this, I was again grilled on concepts such as virtual memory, how HashMaps work, paging, and thrashing.
The final question was: "Given two arrays, find elements which are present at least 2 times in both arrays." I first suggested hashmaps, and then a two-pointer approach after sorting the arrays. I was asked to code the two-pointer solution. However, I later realized I missed a condition for advancing the pointers when there was a mismatch between characters. The interviewer reviewed my code for about 10-15 seconds, and the round ended.
I was ultimately rejected for the position.
Interview Questions (10)
A coding question involving topological sort.
Given a matrix where each row initially contains vowels and then consonants, find the row with the maximum number of vowels.
Discussions on caching, paging, disadvantages of caching, dependency injection, and methods to prevent dependency injection without Spring Boot.
Given a binary tree, how would you store it in a database and then retrieve it, preserving its original structure? This was extended to an n-ary tree.
Given N balls, each with a different weight, combine them into a single ball by repeatedly taking two balls and merging them. The cost of each merge is the sum of the weights of the two balls being combined. Minimize the total cost.
Discussions on virtual memory, how HashMaps work internally, paging, and thrashing.
Given two arrays, find those elements which are present at least 2 times in both arrays.