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

SDE - Intern

Amazon
upvote
share-icon
2 rounds | 4 Coding problems

Interview preparation journey

expand-icon
Preparation
Duration: 3 months
Topics: Data Structures and Algorithms, Object-Oriented Programming System, Operating system, Database Management System
Tip
Tip

Try to do Data Structures and Algorithms based questions and firstly attempt it yourself before going to the solution, also try to do it as quickly as you can. Also prepare for theory subjects like Operating system, Database Management System, etc which I prepared through Coding Ninjas subjective notes and they are very accurate and up to mark.

Application process
Where: Referral
Eligibility: Above 7 CGPA
Resume Tip
Resume tip

Keep your resume simple and complete. Mention some good level projects, your previous experiences and coding achievements if any.

Interview rounds

01
Round
Easy
Video Call
Duration45 Minutes
Interview date17 Oct 2020
Coding problem2

1. Flatten BST To A Sorted List

Moderate
30m average time
70% success
0/80
Asked in companies
AdobeAmazonRakuten India

You have been given a Binary Search Tree (BST). Your task is to flatten the given BST to a sorted list. More formally, you have to make a right-skewed BST from the given BST, i.e., the left child of all the nodes must be NULL, and the value at the right child must be greater than the current node.

A binary search tree (BST), also called an ordered or sorted binary tree, is a rooted binary tree whose internal nodes each store a value greater than all the values in the node's left subtree and less than those in its right subtree.

Follow Up :
Can you solve this in O(N) time and O(H)  space complexity?
Problem approach

You have been given a Binary Search Tree (BST). Your task is to flatten the given BST to a sorted list. More formally, you have to make a right-skewed BST from the given BST, i.e., the left child of all the nodes must be NULL, and the value at the right child must be greater than the current node.
A binary search tree (BST), also called an ordered or sorted binary tree, is a rooted binary tree whose internal nodes each store a value greater than all the values in the node's left subtree and less than those in its right subtree.

Try solving now

2. Sort Linked List

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

You are given a linked list of 'N' nodes where nodes can contain values 0, 1, and 2 only. Your task is to sort the linked list.

Problem approach

You are given a Singly Linked List of integers which is sorted based on absolute value.
You have to sort the Linked List based on actual values.
The absolute value of a real number x, denoted |x|, is the non-negative value of x without regard to its sign.

Try solving now
02
Round
Easy
Video Call
Duration45 minutes
Interview date17 Nov 2021
Coding problem2

1. Binomial Coefficient Problem

Easy
15m average time
85% success
0/40
Asked in companies
HSBCAmazon

A Ninja was learning how to calculate the binomial coefficient. But, learning that alone won’t help the ninja since a lot of problems are required to be solved as homework. Since the ninja is old-fashioned and doesn’t know that a computer can do the same homework in a matter of a few seconds you will have to help with the problems.

You need to complete a function for the ninja that can calculate the binomial of a number where when given two integers 'N' and 'R', the program can calculate its respective binomial coefficient nCr. Since the answer may be very large, calculate the answer modulo 10^9 + 7.

For Example:
Input: 'N' = 5, 'R' = 2
Output: 10

The value of 5C2 is 10
After taking the modulo with 10^9 + 7 we get 10.
Problem approach

A person was learning how to calculate the binomial coefficient. But, learning that alone won’t help the ninja since many problems are required to be solved as homework. Since the person is old-fashioned and doesn’t know that a computer can do the same homework in a matter of a few seconds, you will have to help with the problems.
You need to complete a function for the ninja that can calculate the binomial of a number. When given two integers 'N' and 'R', the program can calculate its respective binomial coefficient nCr. Since the answer may be very large, calculate the answer modulo 10^9 + 7.

Try solving now

2. Largest sub-tree sum

Easy
15m average time
85% success
0/40
Asked in companies
OlaAmazonGoogle inc

You have been given a Binary Tree of integers. You are supposed to return the largest subtree sum in the given Binary Tree.

The subtree sum of a node is defined as the sum of all the node values formed by the subtree rooted at that node (including the node itself).

Example :
For the given binary tree:

Example

Subtree with the largest sum is highlighted in the above image. The sum is (-2 + 4 + 7) = 9
Problem approach

You have been given a Binary Tree of integers. You are supposed to return the largest subtree sum in the given Binary Tree.
The subtree sum of a node is defined as the sum of all the node values formed by the subtree rooted at that node (including the node itself).

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