Hello, readers. I am writing this blog to share my wonderful interview experience with AMAZON. Being from a tier-3 college, getting an internship in one of the ‘FAANG’ is a huge achievement for me. I had been preparing for Amazon for a while and finally by God’s grace, things turned out well. I have now cracked six-months internship in Amazon — one of my dream companies and an amazing place to commence your career.
I will present you the time-line of how events occurred date-wise rather than going into story-mode. Also I will be sharing with you, the questions and how I solved them in the interview. I hope you enjoy the read.
20th September, 2020 — Announcement in my college that Amazon is taking an online test the next day (only for those with CGPA > 8).
21st September, 2020 — At 5.30p.m., the online test was scheduled and the pattern of the test was as follows:
- Debugging(C, C++, Java, Python) [Time given was quite enough.]
- Coding(Any programming language was allowed. 2 coding questions medium to difficult level 70 mins)
- Psychometric test based on Leadership principle — Don’t take it for granted. I would suggest to pay attention while answering to this as well.
- Aptitude and Logical reasoning (Good enough time was given.)
My Performance — I had solved successfully both coding questions(all test cases passed), Debugging required only as little change as possible, so I tried to change the code as less as possible (completed all), logical reasoning was easy-medium.
Outcome: Got shortlisted!
23rd September 2020 — Received an e-mail of getting shortlisted for Amazon next interview round. (Approx. 70 candidates were shortlisted)
24th September 2020 —My first technical interview at 5.30p.m.
Technical Interview 1
(Time — 5.30 p.m.): I introduced myself. My interviewer told me that he would divide the interview into three phases.
Phase 1- Introduction and questions on life instances where I proved my efficiency. (barely 10 minutes, I answered well.)
Phase 2- Data Structures’ Understanding and questions related to it. (Hashing concept and complete conceptual details about it. Internal working, collisions, how to avoid them etc.) (15 minutes, He was satisfied with my answers. Don’t just answer. Explain !)
Phase3- Actual Coding. The coding question was:
Find the maximum length of a substring in a string with non-repeating characters.
Here is the link :
https://www.geeksforgeeks.org/length-of-the-longest-substring-without-repeating-characters/
My Approach to question — I started off by telling the interviewer the brute force approach taking O(n³) time complexity. I quickly told him the idea, he was satisfied and told me optimize it.
My second approach was with hashing and sliding window + two pointer. I explained to him that I will maintain a window of maximum substring with non-repeating characters with two pointers and use hashing to keep the record of those characters. This approach can be seen on GFG (Linear time).
I coded my approach (I was not allowed to compile, but only to write the correct code) in JAVA. He was pretty satisfied with my code and I finished off by telling him the time and space complexity (very imp.). This interview lasted 60 minutes.
Outcome: Selected for the next technical interview !
Same Day, about 10minutes later: I got a call from the coordinator telling me that I have the next interview at 7.00 p.m. in about 15 minutes.
Technical Interview 2
(Time — 7.00 p.m.): I introduced myself. The interviewer directly jumped onto the questions. He asked me two questions. The first question he asked me was:
Given an array of numbers. In one operation you can convert one number into another. Perform the operations such that after say x operations, you are left with only “k” distinct numbers. Minimize x.
example : {1,2,4,1,6} , k = 2, the min(x) = 2. Make 4 into 1 and 6 into 2 resulting array : {1,2,1,1,2}. I only needed to return min(x).
I took 2–3 minutes to think and I came up with an approach of hashing and maintaining a frequency. Example in the above case: {f(1) = 2, f(2) = 1, f(4) = 1, f(6) = 1}. Sort the hash map w.r.t. value instead of key in ascending order. Now keep removing the < key, value> pair till the size of map is k.
[Note: This question can be solved with binary search on answer. After the interview I discovered that. I felt bad as it didn’t strike me then.]
He was satisfied with this approach and I coded it well. He then went for the next question.
Policemen catch thieves – GeeksforGeeks
Given an array of size n that has the following specifications: Each element in the array contains either a policeman…www.geeksforgeeks.org
I gave the interviewer the brute force solution which was exponential. I had to optimize it. I thought for 3–4 minutes when I thought of using a queue. He told me that I was thinking in the right direction. I then gave him a solution with queue with some little hints from his side. I coded the question when he pointed out few mistakes. I rectified them and wrote a correct code in linear time complexity with extra space (queue). He was quite happy and ended up the meeting with a nice ending note. I was positive about the interview at the end. It lasted 70 minutes.
Outcome: Got Selected in AMAZON !
29th September 2020 : I got the official confirmation from my college that I have been selected in Amazon. 11 out 70 people (including me) bagged the internship.
Few helpful advices:
- Stay positive and calm during the interview. You must not sound or be stressed out. Being fine with a challenging question is most important.
- Do not stop interacting for a very long time. You may take time to think may be 3 to 4 mins depending upon how much is left. Do not be silent for too long.
- Interact and share what you are thinking. Don’t start coding immediately. Think first and keep updating the interviewer of what is coming to your mind.
- Explain the code while writing, as in why you had taken a queue here, what would that function return etc. Write clean and understandable code.
- Show intent in solving the question. Even if you are blank, do not give up and think more.
- Listen VERY CAREFULLY to everything the interviewer says. They will pass on hints in a very subtle way. Do not miss out on anything and if you did, make sure to ask him, till you understand the question thoroughly.
- Don’t write too fast and erroneous code, but don’t go too slow either. Maintain a balance.
- Finally, it might be your first interview but it is not your last. Even if you do not get selected, there are hundreds of opportunities and you are not going any where. All the best !
Thank you bhaiya for sharing your experience, it was really helpful.