Amazon Interview Experience for Intern + FTE
Amazon visited our college this year. They currently are on a massive hiring spree, and anyone with decent knowledge can get into it. This is my entire experience.
Online Test: It was a 3 hour long online test, which comprised of Code-Output, Debugging, Behavioral, Aptitude and Coding Questions.
- The questions were simple to moderately difficult. Time management was more important than your coding ability.
- There were 2 coding questions, and you needed to solve both of them.
There were a total of 67 interview shortlists. I was one of them.
Round 1: This was with an SDE 2 at Amazon having more than 6 years of experience.
- The first question she asked was the toughest in all the amazon interviews. The question was: You are given a number, so big that you will need a string to store it. Now, you need to find the next greater palindromic number. I had never seen this question before. I proceeded to tell an approach that would have O(n) time complexity, where n will be the length of the string(a hint would be to traverse the string from the middle). She demanded code as well. I tried, but there were a lot of edge cases with my approach. 45 minutes in, still incomplete.
- She moved to the next question. It was a simple “Minimum steps required by a knight to move from one position to another in a chess board” question. I was able to answer within a second. She told me to move back to the first question. She was really helpful and was writing down whatever I was thinking to manage my edge cases too. My code was still slightly incomplete, but she acknowledged it was a tough question. I got selected for the 2nd round.
Round 2: This too was with an SDE 2. He was really calm and asked me to introduce myself first. After that, he introduced himself and then, we moved to the questions.
- The first question was “Find the median in a stream of numbers”.
- The second was “Find the maximum sum in an array, such that you cannot add alternate elements”.
- The third was “Find the maximum profit you can get by buying and selling stocks(no limit on the number of times you can sell/buy)”. I was able to solve all of them within 15 minutes with optimal time and space complexity, with code.
- He moved to the 4th question: You can make 2 operations on an array: Update any index or find the max in a range of the index. Discuss its time complexity. It was a segment tree solution as I knew Segment Trees helped in ranged queries, but I didn’t know much about them. I still somehow tried to give him the optimal approach as I knew merge sort, we just needed to store all the split-up array states. He was impressed with my solution as it was pretty close to a segment tree, and to be honest so was I. I didn’t think I would be able to think of that solution. He didn’t ask the code for it as he understood I didn’t know much about segment trees and urged me to learn about them as well.
- Then, to my surprise, he moved on to the 5th question. This too was a good one. Given an array, all the numbers in it occur in pairs, and all the duplicate elements are adjacent to each other. However, one element was 3 in number, they were together too. We needed to find that number. I thought of the XOR approach first, but he was expecting a logarithmic time complexity, and O(1) space complexity. I was able to come up with that solution as well with one hint from him(it was: what would you do to verify if the triplet was present in the array or not). If you want another hint, think binary search. It was a great interview. I had a lot of fun giving it. I was selected for the Managerial round.
Round 3: It too was a coding round. It was with an SDE 3.
- He asked me to split a linked list into odd and even halves, without using extra space. I coded it out. Then he asked me to use a function, as now he wanted to split the linked list based on prime and composite. Did that too. Then, he asked me to design a way in which the client can write the condition of splitting the linked list, without affecting the code which I am writing. I used interfaces for it. He was satisfied.
- He then asked me about my projects. My internships. His focus was a lot on STAR paradigms, which thankfully, I had read a day prior to my interview(Situation, Task, Action, and Result). Overall, it was just another Managerial round, with a few easy questions here and there. The final selection list came, and there was my name, along with 8 other students for 6 months internship + FTE. It was one of the happiest days of my life.
For anyone who wants to crack one of these companies, I would recommend you to familiarise yourself with Data Structures and Algorithms. GfG helped me a lot. I remember thinking to myself that the people selected for companies like amazon must be really brilliant, but now that I myself am, I would say it’s not that difficult. Just give it your best. A few practical tips would be to get good at writing what you are thinking, debugging your code, and not hesitating to ask for a hint from the interviewer. Good communication skills help too.