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

SDE - 2

Amazon
upvote
share-icon
2 rounds | 3 Coding problems

Interview preparation journey

expand-icon
Preparation
Duration: 6 Months
Topics: OOPs Concepts, DS & Algo (Array, LinkedList, Tree, String, Stack, Queue, Dynamic Programming),High Level System Design (Different AWS services like EC2, API Gateway, Load Balancer, Auto Scaling Group, RDS, S3 bucket )Low Level System Design- ( Design patterns - Singleton, Factory, Strategy, Class Diagram, Activity Diagram )Database concepts ( ACID properties, CAP theorem, SQL queries )
Tip
Tip

Tip 1 : Practice at least 10-20 questions of DS & Also on each topic from difficulty level easy to hard.
Tip 2 : Prepare well around OOPs concepts and Database concepts.
Tip 3 : If you have 2.5+ year of experience practice around HLD and LLD.

Application process
Where: Linkedin
Eligibility: No Criteria
Resume Tip
Resume tip

Tip 1 : Please mention the keyword related to the work that you have done. (eg. Git, Maven, JUnit, Java, AWS )
Tip 2 : Please mention any certification that you have done. And try to keep your resume within one page.

Interview rounds

01
Round
Hard
Video Call
Duration60 minutes
Interview date15 Jun 2021
Coding problem2

Overall the first round was for 1h. At start interviewer introduced himself and asked for my introduction. After that he directly jumped to coding question. Interviewer was friendly and he gave me suggestion whenever I got stuck somewhere.

1. MaxFrequencyStack

Hard
45m average time
55% success
0/120
Asked in companies
AmazonSalesforceApple

Implement the given class FrequencyStack consisting of three functions :

FrequencyStack() : Creates a new FrequencyStack.

void push(int element) : Pushes the element onto the top of the stack.

int pop() : Returns and remove the most frequent element in the stack. If there are multiple elements with the same maximum frequency then return the integer which is closest to the stack top.

You will be given ‘q’ queries consisting of push and pop operation. In each query input is of following type :

0 : It means we have to pop the element with maximum frequency and return this element.

1 ‘element’ : It means we have to push ‘element’ onto the top of the stack. 

Note: If a pop operation is used in an empty stack nothing happens to the stack, but you have to return  -1.
Problem approach

Step1 : Create a hash-map of num frequency to stack, such that at every occurrence of a number it is progressively allotted to the next stack corresponding to that frequency. E.g. if 5 occurs thrice, then first 5 should go to stack1, second to stack 2 and third to stack 3
Step2 : Create a hash-map of num to frequency which increments and decrements the frequency of a number at push and pop respectively
Step3 : Maintain max frequency of any number across the stacks. This will be used to pop an int from the first map
Step4 : Always pop from max-frequency stack using the max-frequency variable and the first map

Try solving now

2. Binary Tree Maximum Path Sum

Moderate
20m average time
80% success
0/80
Asked in companies
FacebookSamsungCoinbase

You are given a binary tree with ‘N’ nodes.

Your task is to find the “Maximum Path Sum” for any path.

Note :

1. A ‘path’ is a sequence of adjacent pair nodes with an edge between them in the binary tree.
2. The ‘path’ doesn’t need to pass through the root.
3. The ‘path sum’ is the sum of the node’s data in that path. 
Problem approach

I used the recursion approach to solve this problem - 
int maxSum;

public int maxPathSum(TreeNode root) {
maxSum = -1001;
int sum = maxPathSumUtilRecur(root);
return Math.max(maxSum, sum);
}

public int maxPathSumUtilRecur(TreeNode root) {
if(root == null ) return -1001;

int leftSum = maxPathSumUtilRecur(root.left);
int rightSum = maxPathSumUtilRecur(root.right);

int tempMax = Math.max(leftSum, rightSum);

maxSum = Math.max(maxSum, tempMax);
maxSum = Math.max(maxSum, root.val);
maxSum = Math.max(maxSum, leftSum + root.val + rightSum);

return Math.max( root.val, tempMax + root.val);

}

Try solving now
02
Round
Easy
Video Call
Duration60 minutes
Interview date16 Jun 2021
Coding problem1

Overall the first round was for 1h. At start interviewer introduced himself and asked for my introduction. After that he directly jumped to coding question. This was the system design round.

1. System Design Question

Requirements:

The parking lot has one level with multiple rows of spots.
The parking lot can park motorcycles, cars, and buses.
The parking lot has motorcycle spots, compact spots, and large spots.
A car can park in either a single compact spot or a single large spot.
A bus can park in five large spots that are consecutive and within the same row. It cannot park in small spots.
Someone should be able to find where their vehicle is parked via an ID
You need to display open spots in the garage on a board outside at all times

Problem approach

Tip 1 : Solve designing questions.
Tip 2 : Have good understanding of data structure basic operations.
Tip 3 : Have constant discussion with interviewer that am I going in right direction

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 - 2
3 rounds | 4 problems
Interviewed by Amazon
2446 views
0 comments
0 upvotes
company logo
SDE - 2
5 rounds | 7 problems
Interviewed by Amazon
2239 views
0 comments
0 upvotes
company logo
SDE - 2
4 rounds | 8 problems
Interviewed by Amazon
3375 views
0 comments
0 upvotes
company logo
SDE - 2
5 rounds | 7 problems
Interviewed by Amazon
911 views
0 comments
0 upvotes
Companies with similar interview experiences
company logo
SDE - 2
5 rounds | 12 problems
Interviewed by Walmart
29892 views
8 comments
0 upvotes
company logo
SDE - 2
4 rounds | 7 problems
Interviewed by Dunzo
3164 views
0 comments
0 upvotes
company logo
SDE - 2
3 rounds | 4 problems
Interviewed by Samsung
2588 views
0 comments
0 upvotes