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

SDE - Intern

Amazon
upvote
share-icon
3 rounds | 6 Coding problems

Interview preparation journey

expand-icon
Preparation
Duration: 3 months
Topics: Data Structures and Algorithms, Operating Systems, Computer Networks, Java
Tip
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
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.

Interview rounds

01
Round
Hard
Online Coding Interview
Duration90 minutes.
Interview date25 May 2020
Coding problem2

1. Longest Increasing Subsequence

Moderate
30m average time
65% success
0/80
Asked in companies
IBMVisaOYO

For a given array with N elements, you need to find the length of the longest subsequence from the array such that all the elements of the subsequence are sorted in strictly increasing order.

Strictly Increasing Sequence is when each term in the sequence is larger than the preceding term.

For example:
[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)

Try solving now

2. Count Inversions

Moderate
40m average time
55% success
0/80
Asked in companies
Hewlett Packard EnterpriseBNY MellonGrab

For a given integer array/list 'ARR' of size 'N' containing all distinct values, find the total number of 'Inversions' that may exist.

An inversion is defined for a pair of integers in the array/list when the following two conditions are met.

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.

Try solving now
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.

1. Anagram Pairs

Moderate
30m average time
60% success
0/80
Asked in companies
AdobeThought WorksHSBC

You are given two strings 'str1' and 'str1'.


You have to tell whether these strings form an anagram pair or not.


The strings form an anagram pair if the letters of one string can be rearranged to form another string.

Pre-requisites:

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. 

Other examples include:

'triangle' and 'integral'
'listen' and 'silent'
Note:
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.

Try solving now

2. Longest Increasing Subsequence

Moderate
30m average time
65% success
0/80
Asked in companies
IBMVisaOYO

For a given array with N elements, you need to find the length of the longest subsequence from the array such that all the elements of the subsequence are sorted in strictly increasing order.

Strictly Increasing Sequence is when each term in the sequence is larger than the preceding term.

For example:
[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.

Try solving now

3. Given a string with no separator, find the missing number in the string

Moderate
15m average time
85% success
0/80
Asked in companies
AdobeOLX GroupAmazon

You had a sequence of consecutive nonnegative integers. You appended all integers at the end of each other to form a string ‘S’ without any separators. While appending each integer in a string, you forgot to append exactly one integer from the sequence. Now all the integers from a string and you don’t know which integer you have missed.

For example sequence 11, 12, 13 may form a string (without any separators) “1113” if you miss 12.

Your task is to find the missing number in the string such that it is possible to obtain a sequence of consecutive non-negative integers from the given string. If more than one missing integer is present or all the integers are already present or if the string is not valid then the answer will be -1 for all such cases.

Note:
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.

Try solving now
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.

1. Find Number of Islands

Moderate
34m average time
60% success
0/80
Asked in companies
WalmartShareChatAmazon

You are given a 2-dimensional array/list having N rows and M columns, which is filled with ones(1) and zeroes(0). 1 signifies land, and 0 signifies water.

A cell is said to be connected to another cell, if one cell lies immediately next to the other cell, in any of the eight directions (two vertical, two horizontal, and four diagonals).

A group of connected cells having value 1 is called an island. Your task is to find the number of such islands present in the 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)

Try solving now

Here's your problem of the day

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

Skill covered: Programming

How do you remove whitespace from the start of a string?

Choose another skill to practice
Similar interview experiences
company logo
SDE - Intern
3 rounds | 3 problems
Interviewed by Amazon
2163 views
0 comments
0 upvotes
company logo
SDE - Intern
3 rounds | 7 problems
Interviewed by Amazon
1068 views
0 comments
0 upvotes
company logo
SDE - Intern
2 rounds | 3 problems
Interviewed by Amazon
1043 views
0 comments
0 upvotes
company logo
SDE - Intern
1 rounds | 3 problems
Interviewed by Amazon
3502 views
0 comments
0 upvotes
Companies with similar interview experiences
company logo
SDE - Intern
4 rounds | 7 problems
Interviewed by Microsoft
15499 views
1 comments
0 upvotes
company logo
SDE - Intern
3 rounds | 6 problems
Interviewed by Microsoft
8187 views
0 comments
0 upvotes
company logo
SDE - Intern
2 rounds | 4 problems
Interviewed by Microsoft
4915 views
2 comments
0 upvotes