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 | 6 Coding
problems

Preparation

Duration: 3 months

Topics: Data Structures and Algorithms, Operating Systems, Computer Networks, Java

Tip

Tip 1 : Prepare Data Structures and Algorithms well. They mostly check our Problem Solving ability to find the solutions for the real world problems.

Tip 2 : Be enough confident, don't be nervous. Maintain atleast 2 projects in your resume.

Tip 3 : Even if you are stuck in the problem, just give a try. The interviewer will help you definitely for sure.

Application process

Where: Campus

Eligibility: Above 7 CGPA

Resume tip

Tip 1 : Have atleast 2 projects with the latest technologies.

Tip 2 : You should be able to answer each and every thing present in your resume. Don't lie in your resume.

01

Round

Hard

Online Coding Interview

Duration90 minutes.

Interview date25 May 2020

Coding problem2

```
[1, 2, 3, 4] is a strictly increasing array, while [2, 1, 4, 3] is not.
```

Problem approach

I have used the two properties of the Dynamic Programming

1) Overlapping Subproblems

2) Optimal Substructure

Considering the above two properties I was able to solve the given question within the stipulated time.

The time complexity of the above Dynamic Programming (DP) solution is O(n^2)

```
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

Firstly I solved it using the brute force approach i.e., using two for loops. Using this approach only few of the cases have passsed and for the remaining it displayed time limit exceeded.

Later I used the concept of Merge Sort with which all of the remaining cases also passed.

02

Round

Medium

Video Call

Duration60 minutes

Interview date25 Jun 2020

Coding problem3

This was held on Amazon Chime and the interview lasted for 1 hour. Firstly the interviewer asked to introduce about myself, later asked regarding the projects I have mentioned in my resume. Then started displaying the coding question. The first question is related to Strings. Given a string, find any of its permutation or anagram is a palindrome or not. The second question is Given an array of integers, find the length of the longest increasing subsequence. After solving both the questions in the optimized approach, the interviewer asked me for the 3rd question because we were still having time. The third question is Given a string with no separator, find the missing number in the string.The interviewer was very friendly.

```
Anagrams are defined as words or names that can be formed by rearranging the letters of another word. Such as "spar" can be formed by rearranging letters of "rasp". Hence, "spar" and "rasp" are anagrams.
```

```
'triangle' and 'integral'
'listen' and 'silent'
```

```
Since it is a binary problem, there is no partial marking. Marks will only be awarded if you get all the test cases correct.
```

Problem approach

Initially I have solved it using the brute force approach i.e., generating all the permutations of the string and then finding out whether each and every permutation is either palindrome or not.

Later I was asked to optimize it. Then I have solved it using the distinct character i.e., to make a palindrome there should be few repeated character, considering all even length and odd length strings. If a string contains only unique characters, then there is no chance of being a palindrome in any of its permutation. This is how I solved this question.

```
[1, 2, 3, 4] is a strictly increasing array, while [2, 1, 4, 3] is not.
```

Problem approach

I have solved using the dynamic programming. I have applied two steps to solve this problem. They are

1) Overlapping Subproblems

2) Optimal Substructure

With the help of these i was able to solve the problem.

```
1. The string consists of only digits 0 to 9.
2. The numbers will have no more than six digits.
```

Problem approach

Initially I solved this problem using the brute force approach like considering each character and comparing it with the previous and the next character. And then checking the difference between them. Then I was asked to code the same because we are running out of time.

03

Round

Medium

Video Call

Duration90 minutes

Interview date7 Aug 2020

Coding problem1

This was held on Amazon Chime and the interview lasted for 1 hour. Firstly the interviewer asked to introduce about myself, later asked regarding the projects I have mentioned in my resume. Then started displaying the coding question. The first question is number of islands in a matrix.

Problem approach

I have solved the problem easily by applying DFS() on each component. In each DFS() call, a component or a sub-graph is visited. I will then call DFS on the next un-visited component. The number of calls to DFS() gives the number of connected components. BFS can also be used.

A cell in 2D matrix can be connected to 8 neighbours. So, unlike standard DFS(), where we recursively call for all adjacent vertices, here we can recursively call for 8 neighbours only. We keep track of the visited 1s so that they are not visited again.

Time complexity: O(ROW x COL)

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

Start a Discussion

Similar interview experiences

SDE - Intern

3 rounds | 3 problems

Interviewed by Amazon

1241 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