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

SDE - Intern

Amazon
upvote
share-icon
3 rounds | 7 Coding problems

Interview preparation journey

expand-icon
Journey
This was my first attempt at an interview for an internship. 6 months intern. Knowledge of backend technology and DSA was required. Having projects on your resume is mandatory.
Application story
It was an off-campus opportunity with a 6-month internship. Shortlisting was done on the basis of CGPA
Why selected/rejected for the role?
I was rejected after the third round. My answers may not be satisfactory to the interviewer.
Preparation
Duration: 3 months
Topics: Data Structures, Pointers, OOPS, System Design, Algorithms, Dynamic Programming, backend technologies
Tip
Tip

Tip 1: Basics of DSA should be clear, think out loud
Tip 2: Dry the code
Tip 3: Cover all test cases

Application process
Where: Naukri
Eligibility: 8+ CPGA, female candidates only
Resume Tip
Resume tip

Tip 1 : Mention at least 2 project
Tip 2 : Do add too many extracurricular activities
Tip 3 : having internship experience is a plus

Interview rounds

01
Round
Medium
Online Coding Interview
Duration90 minutes
Interview date10 Nov 2021
Coding problem2

1. Maximum meetings

Easy
10m average time
90% success
0/40
Asked in companies
AmazonMicrosoftMakeMyTrip

You are given the schedule of 'N' meetings with their start time 'Start[i]' and end time 'End[i]'.


You have only 1 meeting room. So, you need to return the maximum number of meetings you can organize.


Note:
The start time of one chosen meeting can’t be equal to the end time of the other chosen meeting.


For example:
'N' = 3, Start = [1, 3, 6], End = [4, 8, 7].

You can organize a maximum of 2 meetings. Meeting number 1 from 1 to 4, Meeting number 3 from 6 to 7.
Problem approach

The idea is to solve the problem using the greedy approach which is the same as Activity Selection Problem i.e. sort the meetings by their finish time and then start selecting meetings, starting with the one with least end time and then select other meetings such that the start time of the current meeting is greater than the end time of last meeting selected

Try solving now

2. Longest Subsequence With Difference One

Moderate
30m average time
70% success
0/80
Asked in companies
HSBCAmazonCIS - Cyber Infrastructure

You are given an array “nums” of size N. Your task is to find the length of the longest subsequence of array “nums” such that the absolute difference between every adjacent element in the subsequence is one.

For Example:
If “nums” = {2, 1, 3}.

The valid non-empty subsequences of the array are {2}, {1}, {3}, {2, 1}, {1, 3}, {2, 3} and {2, 1, 3}. So, the longest subsequence satisfying the given conditions are {2, 1} and {2, 3}. The length of the longest subsequence is 2. So, the answer is 2.

The subsequence of an array is a sequence of numbers that can be formed by deleting some or no elements without changing the order of the remaining elements. For example, if the given array “nums” = {1, 2, 5, 4, 8}, then {1, 2, 5, 4, 8}, {1, 5, 8}, {2} are some of the valid subsequences whereas the sequence {4, 2} is not a valid subsequence as the order of the elements differ from the original array.

Note:
Any subsequence of length = 1 is also a valid subsequence.
Problem approach

The idea is that all the non-negative numbers must be included in the sub-sequence because such numbers will only increase the value of the total sum. 
Now, it’s not hard to see among negative numbers, the larger ones must be chosen first. So, keep adding the negative numbers in non-increasing order of their values as long as they don’t decrease the value of the total sum below 0

Try solving now
02
Round
Hard
Video Call
Duration60 minutes
Interview date22 Nov 2021
Coding problem2

1. Minimum possible travel cost among N cities

Moderate
40m average time
65% success
0/80
Asked in companies
AmazonSamsungErnst & Young (EY)

Ninjaland is a country having 'N' states numbered from 1 to 'N'. These 'N' states are connected by 'M' bidirectional roads. Each road connects to different states and has some cost to travel from one state to another. Now, the chief wants you to select 'N' - 1 roads in such a way that the tourist bus can travel to every state at least once at minimum 'COST'.

For example :
Consider a country having 4 states numbered from 1 to 4. These 4 states are connected by 5 bidirectional roads given as :
1 --- 2 with cost = 8
2 --- 3 with cost = 6
3 --- 4 with cost = 5
1 --- 4 with cost = 2
1 --- 3 with cost = 4

The map of the country can be represented as:

Now, the best way to choose 3 roads is:

The cost of travelling from any state to all other states is  2 + 4 + 6 i.e. 12.
Problem approach

The approach is very simple, just travel by the bus which has the lowest cost so far. Whenever a bus with an even lower cost is found, change the bus from that city. Following are the steps to solve: 


Start with the first city with a cost of C[1].
Travel to the next city until a city j having cost less than the previous city (by which we are travelling, let’s say city i) is found.
Calculate cost as abs(j – i) * C[i] and add it to the total cost so far.
Repeat the previous steps until all the cities have been traversed.

Try solving now

2. Lexicographically smallest permutation of a string with given subsequences

Easy
20m average time
80% success
0/40
Asked in companies
Expedia GroupAmazonOla

You have been given a string ‘S’. You need to return the lexicographically smallest subsequence of ‘S’ that contains all the distinct characters of ‘S’ exactly once. Return the string as mentioned above.

A string is a subsequence of a given string, that is generated by deleting some character of a given string without changing its order.

Example:
Let S = “ababc”. The lexicographically smallest subsequence containing all the distinct characters of strings is “abc”. 
Note:
Strings consist of only lowercase characters.

You do not need to print anything; it has already been taken care of. Just implement the function.
Problem approach

First of all, by induction it can prove that the product of count of ‘x’ and count of ‘y’ should be equal to the sum of the count of a subsequence of ‘xy’ and ‘yx’ for any given string. If this does not hold then the answer is ‘Impossible’ else answer always exist.

Now, sort the given string so the count of a subsequence of ‘yx’ becomes zero. Let nx be the count of ‘x’ and ny be count of ‘y’. let a and b be the count of subsequence ‘xy’ and ‘yx’ respectively, then a = nx*ny and b = 0. Then, from beginning of the string find the ‘x’ which has next ‘y’ to it and swap both until you reach end of the string. In each swap a is decremented by 1 and b is incremented by 1. Repeat this until the count of a subsequence of ‘yx’ is achieved i.e. a becomes p and b becomes q.

Try solving now
03
Round
Medium
Video Call
Duration75 minutes
Interview date22 Nov 2021
Coding problem3

1. Detect The Cycle

Easy
0/40
Asked in companies
AmazonHashedInWingify

Kevin has given you a Singly Linked List that contains only integers. You have to determine if it forms a cycle or not.

A cycle occurs when a node's next pointer points back to a previous node in the list.

Problem approach

Traverse the list individually and keep putting the node addresses in a Hash Table. 
At any point, if NULL is reached then return false 
If the next of the current nodes points to any of the previously stored nodes in Hash then return true.

Try solving now

2. Rotate DLL

Moderate
10m average time
90% success
0/80
Asked in company
Amazon

You are given a doubly-linked list with 'N' nodes, rotate the linked list counter-clockwise by 'K' nodes. 'K' is a positive integer and is smaller than the number of nodes in the linked list, that is 'N'.

A doubly linked List (DLL) contains an extra pointer, called the previous pointer, together with the next pointer and data which are there in the singly linked list such that both forward and backward navigation is possible.

For example
The given linked list is - 

If K = 3, then the list after rotating it by K nodes is:

Note:
1. The value of any node in the linked list will not be equal to -1.
Try solving now

3. Snake and Ladder

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

You have been given a Snake and Ladder Board with 'N' rows and 'N' columns with the numbers written from 1 to (N*N) starting from the bottom left of the board, and alternating direction each row.

For example

For a (6 x 6) board, the numbers are written as follows:

6*6 Board

You start from square 1 of the board (which is always in the last row and first column). On each square say 'X', you can throw a dice which can have six outcomes and you have total control over the outcome of dice throw and you want to find out the minimum number of throws required to reach the last cell.
Some of the squares contain Snakes and Ladders, and these are possibilities of a throw at square 'X':
You choose a destination square 'S' with number 'X+1', 'X+2', 'X+3', 'X+4', 'X+5', or 'X+6', provided this number is <= N*N.
If 'S' has a snake or ladder, you move to the destination of that snake or ladder.  Otherwise, you move to S.
A board square on row 'i' and column 'j' has a "Snake or Ladder" if board[i][j] != -1. The destination of that snake or ladder is board[i][j].
Note :
You can only take a snake or ladder at most once per move: if the destination to a snake or ladder is the start of another snake or ladder, you do not continue moving - you have to ignore the snake or ladder present on that square.

For example, if the board is:
-1 1 -1
-1 -1 9
-1 4 -1
Let's say on the first move your destination square is 2  [at row 2, column 1], then you finish your first move at 4 [at row 1, column 2] because you do not continue moving to 9 [at row 0, column 0] by taking the ladder from 4.

A square can also have a Snake or Ladder which will end at the same cell.
For example, if the board is:
-1 3 -1
-1 5 -1
-1 -1 9
Here we can see Snake/Ladder on square 5 [at row 1, column 1] will end on the same square 5.
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 | 3 problems
Interviewed by Amazon
2147 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
15500 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