I applied for the 6 months internship through referral at the end of November. I thought if you apply through a referral it takes only 1-2 days to get back from HR but after 2-3 days, when no one contacted me I thought I am not going to hear back from them. But after two weeks, I got the mail about the online coding round.
Round 1: Online Coding Round
There were 2 coding questions and 28 MCQ.
- Infix to Postfix conversion
- Very easy string manipulation problem
I was able to solve both of them.
After two days, they told me about the onsite interview and that I had to go to the Amazon Bangalore office.
On the day of the interview, I went to the office. There were about 70-80 other students.
Round 2: Technical Interview
This was 60 minutes round and 2 coding questions were asked. I solved one completely and one partially. My interviewer was cool and friendly. Although he was not smiling a lot, he made me feel like we are having a discussion about the question. He started with the usual About you question and then directly jumped to the coding questions.
Q1. You are on the ground stair and you have to reach ‘Nth’ stair. At any stair, you can take at most ‘K’ steps. Find the total number of ways you can reach the Nth stair. int countWays(int N, int K)
He explained to me the question, then explained it through a sample test case. And then asked me to first explain the approach and if he is satisfied with the approach, then only I can code. He told me that he will also note things down on his laptop.
Firstly, I gave him the recursive brute force solution(Because that’s what CTCI says). Then he asked me to optimize it. Then I gave him the DP-approach with time complexity O(N*K) and space complexity O(N). Then he asked me to further optimize it. I used another variable to store the sum of last K stairs and increase its value for ith stair and decrease for (i-k)th stair. Now my time complexity was O(N) and space complexity was O(N). I thought that now I can code, but he again asked me to optimize the space. Then I gave him O(K) space queue solution. Now he was satisfied with the approach and asked me to code it. Again he explained to me what he is expecting while writing the code. (Readable, modular, indented, meaningful variable name).Then I wrote the code, he checked it and was satisfied.
Q2. Smallest string with swaps – http://https//leetcode.com/problems/smallest-string-with-swaps/
It was difficult for me to come up with the brute force solution and I told him. Then he gave me some hints, and with his help, I came up with a brute force solution. After that, we had some discussion that whether the brute force solution will always give the correct solution. After that, he asked me to optimize it, which I was trying but he told me that time is up and if I have any questions. I just asked him about the role of the intern and which team is hiring the intern.
After 15 minutes, they told me that I am moving the next round.
Round 2: Technical Interview
It was also 60 minutes round and 3 coding questions were asked. First, he asked me to give a brief introduction. Then he asked me about my internship and my projects. Then he told me what he is expecting from me in this round. He told me that he will ask 2-3 questions, depending on the time, and I need to explain to him the logic first, and then code. Also, follow good coding practices. He told me that he will I cannot overwrite writing the code, and that he will write the exact code on his machine(not sure if he really did that, but he was typing something on his laptop).
Q1. Trapping rainwater problem
Firstly, gave him the brute force solution O(N^2). He told me to optimize it. Then gave him the leftMax and rightMax array approach. He said I can code now. While writing the code, I made sure to keep it clean, made it as modular as I can, use the descriptive variable name. He looked at my code, asked me a few questions, and then moved to the second question.
Q2. https://www.geeksforgeeks.org/dynamic-programming-building-bridges/ Since I’ve already done this question, I told him that I just need to find the LIS in the array. He told me how I would do that. I gave him O(N^2) approach. He said it is okay and asked me to code.
Q3. It was an easy question. He asked me there is a land, and there is a lake inside. I need to find the size of the lake. I told him that I can use 1 for land, 0 for water, and then apply DFS when I encounter any 0. Then he asked questions on DFS and how I will do that. I explained to him my approach and then he asked me to write the pseudo-code for it.
Then he asked if I have any questions. I asked him some questions.
Then after about 20 min, HR called him and congratulated me.
Advice for interview
- No matter how much time is left, make sure your code follows good practices. I remember a time when I thought I will write code super fast and then explain to him the code, but it doesn’t work like that. They will keep the paper where you wrote the code, and then later review it in case they have any doubt on you. So make sure, what you write is clearly understandable. Your code, your logic, your diagram, your test cases.
- Make sure you are having discussions and not an interview. Make sure to explain your approach and your answers to his/her questions in a way that makes it look like a discussion. How? Explain things like you know things, don’t just guess, explain why you are thinking recursive solution.
- Always look up on the internet the answers to your questions. The next interviewer might ask you.
- Amazon Interview Experience | SDE-1 offcampus
- Amazon Interview Experience Offcampus for SDE-1
- Mahindra Comviva Interview Experience 2020 (Product/Software Development OffCampus)
- Microsoft Internship Experience | Off-Campus Internship (Hyderabad)
- TIAA Internship Experience - Pool campus for Internship
- Amazon Interview experience | Set 127 (For Internship)
- Amazon Interview Experience | Set 149 (On-Campus for Internship)
- Amazon Interview Experience | Set 198 (On-Campus for Internship)
- Amazon Interview Experience | Set 199 (On-Campus for Internship)
- Amazon Interview Experience | 197 (On-Campus for Internship)
- Amazon Interview Experience | Set 204 (On-Campus for Internship)
- Amazon Interview Experience | Set 205 (On-Campus for Internship)
- Amazon Interview Experience | Set 207 (On-Campus for Internship)
- Amazon Interview Experience | Set 208 (On-Campus for Internship)
- Amazon Interview Experience | Set 211 (On-Campus for Internship)
- Amazon Interview Experience | 215 (On-Campus for Internship)
- Amazon Interview Experience | 216 (On-Campus for Internship)
- Amazon Interview Experience | Set 227 (On-Campus for Internship and Full-Time)
- Amazon Interview Experience | Set 228 (On-Campus for Internship)
- Amazon Interview Experience | Set 265 (On-Campus Internship)
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.