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

SDE - Intern

Amazon
upvote
share-icon
2 rounds | 4 Coding problems

Interview preparation journey

expand-icon
Preparation
Duration: 7-8 months
Topics: Data Structures, Algorithms, Operating System, DBMS , OOPS
Tip
Tip

Tip 1 : Create a timetable and set goals. Keep aside 3-4 hours for studying. Consistency is the key.
Tip 2 : Do atleast 2 projects
Tip 3 : Know the complexities of the code that you’ve written.

Application process
Where: Campus
Eligibility: 65% in 12th
Resume Tip
Resume tip

Tip 1 : Do not put false things on resume.
Tip 2 : You should have good projects to showcase.

Interview rounds

01
Round
Medium
Online Coding Interview
Duration140 minutes
Interview date22 May 2020
Coding problem2

Timing: 7 pm

1. Minimum Cost to cross Grid

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

You are given a 2 - D grid having ‘N’ rows and ‘M’ columns. Each cell of the grid has an integer value written on it which denotes the cost it takes to pass through that cell. You are currently present at the Top-Left cell (0,0) and you want to reach the Bottom-Right cell (N - 1, M - 1). To do so, you start moving from the Top-Left cell and move through any of the adjacent cells until you reach the Bottom-Right cell. The total cost of the path will be the sum of the costs of all the cells that you have passed through in the path.

Given the cost of each cell in a 2 - D matrix 'MAT', your task is to find the minimum total cost that you need to spend to reach the Bottom-Right cell if you are starting from the Top-Left cell.

Note:
1) From any cell you can move UP, DOWN, LEFT, or RIGHT.

2) You cannot move out of the grid.
Problem approach

I Used Dynamic Programming to solve it.

Try solving now

2. Sub Matrices With Sum Zero.

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

You’re given a square matrix 'MAT' of order N. Your task is to find the number of non-empty sub-matrices such that the sum of all the elements inside the submatrix is zero.

NOTE:

1. The matrix may also contain some negative elements.
2. A square matrix is a matrix with the same number of rows and columns.
A matrix obtained by deleting some (possibly zero) of the rows and/or columns from the beginning and/or from the end of a matrix is said to be a sub-matrix of the given matrix.

Example: Given a matrix
 A = 1 2
     3 4

Possible non-empty sub-matrices of A are represented below by bold numbers-

alt text

Problem approach

I used HashMap to solve it.

Try solving now
02
Round
Easy
Video Call
Duration90 minutes
Interview date11 Jun 2020
Coding problem2

Timing : 2 pm
The interviewer was very friendly.

1. Print boundary Values of the Binary Tree

Hard
20m average time
85% success
0/120
Asked in companies
Expedia GroupGartnerMorgan Stanley

You are given a binary tree having 'n' nodes.


The boundary nodes of a binary tree include the nodes from the left and right boundaries and the leaf nodes, each node considered once.


Figure out the boundary nodes of this binary tree in an Anti-Clockwise direction starting from the root node.


Example :
Input: Consider the binary tree A as shown in the figure:

alt text

Output: [10, 5, 3, 7, 18, 25, 20]

Explanation: As shown in the figure

The nodes on the left boundary are [10, 5, 3]

The nodes on the right boundary are [10, 20, 25]

The leaf nodes are [3, 7, 18, 25].

Please note that nodes 3 and 25 appear in two places but are considered once.
Problem approach

Step 1 : I first applied vertical traversal and store it in a hashmap and print boundary element of each value in the hashmap.
Step 2 : He asked me the time complexity and space complexity.
Step 3 : He asked to optimise the solution and gave some hints.
Step 4 : I wasn't able to think at that points but he was expecting something using recursion.

Try solving now

2. Segregate even and odd nodes in a Linked List

Easy
15m average time
85% success
0/40
Asked in companies
OlaPaytm (One97 Communications Limited)Dunzo

You are given the head node of a singly linked list 'head'. Your task is to modify the linked list in such a way that all the even valued nodes appear before the all odd valued node and order of nodes remain the same.


Example :-
The given singly linked list is  6 -> 5 -> 3 -> 4 -> 7 -> 1 -> 2 

subsequence

The modified linked list should have all even values in starting and odd values in the end.
Problem approach

Step 1 : I told him to create two linkedLists. One for odd elements and another for even elements. and while traversing the given list adding elements to even and odd lists respectively.
Step 2 : He asked me to optimise the space complexity.
Step 3 : I told him to change the list in place which will be taking O(1) complexity.

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

Suppose list1 is [2, 133, 12, 12], what is max(list1) in Python?

Choose another skill to practice
Start a Discussion
Similar interview experiences
company logo
SDE - Intern
3 rounds | 3 problems
Interviewed by Amazon
1241 views
0 comments
0 upvotes
company logo
SDE - Intern
3 rounds | 7 problems
Interviewed by Amazon
453 views
0 comments
0 upvotes
company logo
SDE - Intern
2 rounds | 3 problems
Interviewed by Amazon
454 views
0 comments
0 upvotes
company logo
SDE - Intern
1 rounds | 3 problems
Interviewed by Amazon
824 views
0 comments
0 upvotes
Companies with similar interview experiences
company logo
SDE - Intern
4 rounds | 7 problems
Interviewed by Microsoft
12620 views
1 comments
0 upvotes
company logo
SDE - Intern
3 rounds | 6 problems
Interviewed by Microsoft
7476 views
0 comments
0 upvotes
company logo
SDE - Intern
2 rounds | 3 problems
Interviewed by Google
5326 views
1 comments
0 upvotes