Code360 powered by Coding Ninjas X Naukri.com. Code360 powered by Coding
Ninjas X Naukri.com

Amazon interview experience Real time questions & tips from candidates to crack your interview

Amazon

3 rounds | 7 Coding
problems

Journey

I started preparing for my placement from the starting of the B.Tech. Getting into one of MNCs in India was my dream, and I researched about it a lot like What are the most essential topics fro FAANG Interview?, How should you approach your graduation if you want to make it count?, etc. I practised DSA continuously for three years, and I thought I had a great base for them but at last I was not selected into any of companies in FAANG. But I still tried to get into them some day, and then, after 2 years of completing my graduation I got this opportunity.

Application story

I saw this opportunity on the amazon company websites. I was curious about it from the very start as getting to any of those giants of the industry was my dream. After few days I got a mail from the HR about the selection of my resume for the interview and the interview process.

Why selected/rejected for the role?

I think I was on point with my coding solutions to the questions asked in the interviews. I provided the optimal solutions and I was giving correct explanations to some theory questions asked.

Preparation

Duration: 4 months

Topics: Data Structures and Algorithms, OOPS, DBMS, Computer Networks, Operating System

Tip

Tip 1 : Practice questions from all the topics as much as possible

Tip 2 : Be very much attentive while doing projects in college or anywhere, they are asked in detail if mentioned in resume.

Tip 3 : Be consistent while practicing and do a variety of questions rather than doing more questions of same kind.

Application process

Where: Company Website

Eligibility: Above 6.5 CGPA, No backlogs

Resume tip

Tip 1 : You should know whatever you have mentioned in your resume. Don't brag in your resume ever. Be very precise. It doesn't matter how much you have done, what matters is you are very much confident and clear about what you have done.

Tip 2 : Put your projects and the language you code in for sure in your resume.

01

Round

Easy

Online Coding Interview

Duration90 minutes

Interview date22 May 2020

Coding problem2

This was an online technical round on the mettl platform, the test window was open from 22 to 25 May 2020

The test had 28 mcqs and 2 coding questions.

The test was proctored. One needed to have webcam on.

A sample test link was provided before test to get familiar with the mettl platform.

```
A pair ('ARR[i]', 'ARR[j]') is said to be an inversion when:
1. 'ARR[i] > 'ARR[j]'
2. 'i' < 'j'
Where 'i' and 'j' denote the indices ranging from [0, 'N').
```

Problem approach

Brute Force Approach got submitted.

Approach:

I used and O(n^2) approach, where I used 2 for loops.

step1 : First loop was from index 0 to sizeof given array i.e. i

step2 : inside this was another loop from index of first loop + 1 to the end of array i.e. j.

step3 : If the value of array[i]>array[j] add 1 to the count of inversions.

Then return count of inversions at the end of both the for loops.

```
For example:
If the given array is {1, 5, 2, 3, 4}, the output will be 2 (which is GCD of 2 and 4, all other pairs have a GCD of 1)
```

Problem approach

I used simple approach to solve this problem.

Step1 : First of all make a GCD function using Euclidean Algorithm. O(NlogN)

Step2 : Then using two nested for loops find gcd of all the possible pair of the array and find their gcd and return the maximum of all gcd.

02

Round

Medium

Video Call

Duration60 minutes

Interview date1 Jul 2020

Coding problem3

Time : 12pm to 1pm

Mode of Interview : Amazon Chime Video

LiveCode : To write code, it was not a compiler

The interviewer was quite supportive.

Given an array A( all 0 values initially) of size n, given q queries(query eg1: start = i, end =j)(here start and end are index such that you have to add 1 from start index to end index in array A). Return the array A after performing q queries.eg : size of array = 10queries:q1 = 5 8q2 = 6 8output = 0 0 0 0 0 1 2 2 2 0

Problem approach

For a query q(a,b):

Step 1 : I added 1 in the array at the starting index of the given query ( that is the left boundary of given range).

for the ending index (that is the right boundary of the range) I subtracted 1 from the value present at index b+1. if b+1 is a valid index of the given.

Step 2 : Repeat the same process for all the given queries and at the end find cumulative sum of the array an that means

for (int i=1 to size of array)

array[i] = array[i-1]

Step 3 : Return the resulting array.

```
A majority element is an element that occurs more than floor('N' / 2) times in the array.
```

Problem approach

Return Middle element of the array that is return A[n/2].

Problem approach

1)Consider all 0â€™s in arr[] as -1.

2)Create a hash table that holds the count of each sum[i] value, where sum[i] = sum(arr[0]+..+arr[i]), for i = 0 to n-1.

3)Now start calculating cumulative sum and then we get increment count by 1 for that sum represented as index in the hash table. Sub-array by each pair of positions with same value of cumulative sum constitute a continuous range with equal number of 1â€™s and 0â€™s.

4)Now traverse the hash table and get the frequency of each element in the hash table. Let frequency be denoted as freq. For each freq > 1 we can choose any two pair of indices of sub-array by (freq * (freq â€“ 1)) / 2 number of ways . 5)Do the same for all freq and sum up the result that will be the number all possible sub-arrays containing equal number of 1â€™s and 0â€™s.

03

Round

Medium

Video Call

Duration60 minutes

Interview date12 Jul 2020

Coding problem2

Time : 11 am to 12am

Mode of Interview : Amazon Chime Video

LiveCode : To write code, it was not a compiler

The interviewer was quite supportive.

Problem approach

I solved this problem with the very first approach that can come to anyone's mind.

That is using recursion

Step 1 : Make a separate function to find middle element of a list using runner technique.

Step 2 : Find middle element of the list and make it the root of the bst and pass the left part of middle node of the list in the function to return the left node of the current node of bst and right part to get the right child subtree of the current node of bst.

Step 3 : Return root of bst.

```
getSize: Returns an integer. Gets the current size of the stack
isEmpty: Returns a boolean. Gets whether the stack is empty
push: Returns nothing. Accepts an integer. Puts that integer at the top of the stack
pop: Returns nothing. Removes the top element of the stack. It does nothing if the stack is empty.
getTop: Returns an integer. Gets the top element of the stack. Returns -1 if the stack is empty
```

Here's your problem of the day

Solving this problem will increase your chance to get selected in this company

Suppose list1 is [2, 133, 12, 12], what is max(list1) in Python?

Choose another skill to practice

Similar interview experiences

SDE - Intern

3 rounds | 3 problems

Interviewed by Amazon

1240 views

0 comments

0 upvotes

SDE - Intern

3 rounds | 7 problems

Interviewed by Amazon

453 views

0 comments

0 upvotes

SDE - Intern

2 rounds | 3 problems

Interviewed by Amazon

454 views

0 comments

0 upvotes

SDE - Intern

1 rounds | 3 problems

Interviewed by Amazon

823 views

0 comments

0 upvotes

Companies with similar interview experiences

SDE - Intern

4 rounds | 7 problems

Interviewed by Microsoft

12619 views

1 comments

0 upvotes

SDE - Intern

3 rounds | 6 problems

Interviewed by Microsoft

7476 views

0 comments

0 upvotes

SDE - Intern

2 rounds | 3 problems

Interviewed by Google

5326 views

1 comments

0 upvotes

they have asked u only Btech academics or 12th and 10th alsoand how they are selecting by Btech cgpa or 12th & 10th