I applied for a 6-month internship through a referral at the end of November. I think if you apply through a referral, it only takes 1-2 days to get a response from HR, but after 2-3 days, when no one contacts me, I don’t think I’ll hear from them again. But two weeks later, I got an email about an online coding session.

Round 1: Online coding

There were 2 coding problems and 28 McQs.

  1. Conversion from infix to suffix
  2. Very simple string manipulation problem

I can solve two problems.

Two days later, they told me about the on-site interview and I had to go to Amazon’s Bangalore office.

On the day of the interview, I went to the office. There are also about 70-80 students.

Round 2: Technical interview

This is 60 minutes and two coding questions are asked. I completely solved part of the problem. My interviewer was cool and friendly. Even though he didn’t laugh much, he made me feel like we were talking about it. He starts with common questions about you, then jumps straight to coding questions.

Q1. You’re on the ground staircase, and you have to get to the “NTH” staircase. You can only perform “K” steps at most on any staircase. Find the total number of stairs that can be reached at the NTH.

int countWays(int N, int K)

He explained the problem to me, and then explained it through a sample test case. Then ask me to explain the method first, if he is happy with the method, then only I can write the code. He told me he would also write it down on his laptop.

First, I gave him the recursive violence solution (because that’s what CTCI says). Then he asked me to optimize it. Then, I gave him DP method with time complexity O(N * K) and space complexity O(N). Then he asked me to optimize it further. I used another variable to store the sum of the last K stairs and increase its value for the ith stairs and decrease it for the (I – K) stairs. Now I have O(N) in time and O(N) in space. I thought I was ready to code now, but he again asked me to optimize the space. Then I gave him the O(K) spatial queue solution. Now he was happy with the approach and asked me to code it. Again, he explained to me what to expect when he wrote the code. (readable, modularized, indented, meaningful variable names). Then I wrote the code, and he looked at it and was satisfied.

Q2. With the exchange of minimum string – https://leetcode.com/problems…

It was hard for me to come up with a strong solution, I told him. Then he gave me some tips, and with his help, I came up with a powerful solution. After that, we had some discussion about whether brute force solutions would always provide the right solution. After that, he asked me to optimize it, I was trying, but he told me the time was up if I had any questions. I just asked him about the role of interns and which teams were hiring interns.

After 15 minutes, they told me I was going to play the next round.

Round 2: Technical interview

Again, 60 minutes, three coding questions. First, he asked me to make a brief introduction. Then he asked me about my internship and my project. Then he told me his expectations for the round. He told me that he would ask 2-3 questions depending on the time, and that I would need to explain the logic to him first and then code. Also, follow good coding practices. He told me that I wouldn’t be able to cover writing the code, and that he would be writing the exact code on the computer (not sure if he did, but he was typing on his laptop).

Q1. Trapped Rainwater

First, give him the brute force solution for O(N ^ 2). He told me to optimize it. Then I gave him the leftMax and rightMax array methods. He said I could code now. When I write the code, I make sure to keep it clean and use descriptive variable names to make it as modular as possible. He looked at my code, asked me a few questions, and then moved on to the second question.

Q2.

Now that I’ve answered that question, I told him I just need to find LIS in the array. He told me what I should do. I gave him the O(N ^ 2) method. He said yes and asked me to code.

Q3. It’s a simple question. He asked me where there was a piece of land with a lake in it. I need to find out the size of the lake. I told him I could use a 1 for land, a 0 for water, and then use DFS whenever I encountered any zeros. Then he asked questions about DFS and how I would do it. I explained my method to him, and he asked me to write pseudocode for it.

Then he asked me if I had any questions. I asked him some questions.

Then about 20 minutes later, HR called him and congratulated me.

My interview

  1. No matter how much time you have left, make sure your code follows good practices. I remember thinking for a while that I would write the code quickly and then explain it to him, but that didn’t work. They’ll leave the paper where you wrote the code, and then review it if they have any questions about you. So make sure that what you write is understandable. Your code, logic, diagrams, test cases.
  2. Make sure you’re in a discussion and not in an interview. Be sure to explain your approach and answer to his/her question in a discussion format. How’s that? Explain things like what you know, not just guesses, and explain why you’re considering a recursive solution.
  3. Always look for answers to your questions on the Internet. The next interviewer might ask you.

For more information about interview, please refer to: LSBin-IT Development Technology: https://www.lsbin.com/

See more interview questions:

  • Jpmorgan chase interview questions: https://www.lsbin.com/3218.html
  • The operating system try: https://www.lsbin.com/3196.html
  • 10 common interview mistakes: https://www.lsbin.com/2782.html