Amazon Interview Experience 2m-Internship

There were two rounds of my selection process.

Round 1 (Online Assessment Test):

The online test consists of 2 coding questions to be completed in 60 minutes. The questions were of medium difficulty level and I was able to solve both of them in under 45 minutes.

Here’s the first question:

(I think it is available on the premium version of leetcode) Count the Number of K-Big Indices

You are given a 0-indexed integer array nums and a positive integer k. We call an index i k-big if the following conditions are satisfied:

->There exist at least k different indices idx1 such that idx1 < i and nums[idx1] < nums[i].

->There exist at least k different indices idx2 such that idx2 > i and nums[idx2] < nums[i].

Return the number of k-big indices.

Example:

Input: nums = [2,3,6,5,2,3], k = 2

Output: 2

The second question was a medium level question based on strings. I don’t exactly remember the question.

I had to complete a 15 minute survey after the completion of my Online Assessment. It was more like a personality test.

I gave the Online Assessment in September and did not get any mails regarding my selection or rejection for two months. I thought I had been rejected. But then I received a mail in mid-November regarding my interview schedule. I had 10 days for my interview preparation and the mail clearly stated that I’ll be asked two coding questions.

Round 2 (Technical Interview):

My interviewer introduced themselves and asked me to introduce myself and then asked me the kind of difficulties I faced during working on my MERN-stack project that I had mentioned in my resume. He then jumped into the coding questions. I was provided an online IDE by amazon itself and I had to code my solutions and dry run them over there itself. Both the questions are available on Leetcode.

Question 1:

The first question was a variation of the famous question “House Robber”. I solved the question using the memorization approach of dynamic programming. The interviewer then asked me how were then values stored in the dp vector. He then asked me to write the tabulation approach for storing data in a particular index of the dp vector in the same question. I was able to do the same.

The first question took me around 25 minutes. He also asked for the time and space complexities of my code.

Question 2:

We are given an array asteroid of integers representing asteroids in a row. For each asteroid, the absolute value represents its size, and the sign represents its direction (positive meaning right, negative meaning left). Each asteroid moves at the same speed. Find out the state of the asteroids after all collisions. If two asteroids meet, the smaller one will explode. If both are the same size, both will explode. Two asteroids moving in the same direction will never meet.

Example:

Input: asteroids = [5,10, -5]

Output: [5,10]

Explanation: The 10 and -5 collide resulting in 10. The 5 and 10 never collide.

Problem Link: https://leetcode.com/problems/asteroid-collision/

I solved this question in about 25 minutes. The interviewer was impressed by my approach.

Overall, I was able to solve both the questions in about an hour. The interviewer then asked me if I had any questions for him. I asked him about the type of projects one gets to work on as an intern and his experience as he himself joined amazon as an intern first.

My interview experience was really good. The interviewer was very friendly and did give me hints whenever I got stuck.

Final Result: Selected.

It was a great news for me as I got selected after facing a lot of rejections. I would advise you to keep practicing DSA questions regularly and always remember “Consistency is the key”. Stay focused, keep working hard and do not ever lose hope.