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

SDE - 1

Amazon
upvote
share-icon
2 rounds | 4 Coding problems

Interview preparation journey

expand-icon
Preparation
Duration: 2 months
Topics: All major Data Structures and Algorithms - Algorithms related to topics: Graphs, trees, arrays, etc.
Tip
Tip

Don’t panic in any situation during interview and have confidence on yourself. Also, pay more focus on Data structures and algorithms as they are most important part of the interview. I practiced a lot of questions from Coding Ninjas

Application process
Where: Campus
Resume Tip
Resume tip

Resume doesn't matter as much if you have the right skills, at least for On-campus placements as most companies have shortlisting criteria based on CGPA, not on the resume. But keep your resume simple and readable.

Interview rounds

01
Round
Easy
Online Coding Test
Duration120 minutes
Interview date2 Aug 2019
Coding problem2

This was Coding round and contained two coding questions.

1. Sum Between 0s

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

Linked List Sum of Nodes Between 0s

Given a linked list which contains a series of numbers separated by “0”. Add them and store them in the linked list in-place.

Note :There will not be continuous zeros in input.

Problem approach
  • I simply used linked list traversal to solve this question, just stores the sum of all nodes in variable sum while 0 has not been found and then change pointers of previous nodes. It passed all test cases in the first attempt itself and which boosted my confidence very much.
Try solving now

2. Trapping RainWater

Moderate
15m average time
80% success
0/80
Asked in companies
HCL TechnologiesCiti BankAtlassian

Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining.

Examples:

 

Input: arr[]   = {2, 0, 2}

Output: 2

Explanation:

The structure is like below

We can trap 2 units of water in the middle gap.

 

Input: arr[]   = {3, 0, 2, 0, 4}

Output: 7

Explanation:

Structure is like below

We can trap "3 units" of water between 3 and 2,

"1 unit" on top of bar 2 and "3 units" between 2  

and 4.  See below diagram also.

 

Input: arr[] = [0, 1, 0, 2, 1, 0, 1, 3, 2, 1, 2, 1]

Output: 6

 

Explanation:

The structure is like below

Trap "1 unit" between first 1 and 2, "4 units" between

first 2 and 3 and "1 unit" between second last 1 and last 2.

Problem approach

I use precomputation in this question in which I store largest length of bar on left and and right for each bar and then find the answer.  

Try solving now
02
Round
Easy
Face to Face
Duration120 minute
Interview date3 Aug 2019
Coding problem2

This was face to face round held in campus itself.

1. Search in Rotated Sorted Array

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

 Devise the most optimised way way to find an element in the rotated sorted array.

sortedPivotedArray

sortedPivotedArray

 

Input  : arr[] = {5, 6, 7, 8, 9, 10, 1, 2, 3};

        key = 3

Output : Found at index 8

 

Input  : arr[] = {5, 6, 7, 8, 9, 10, 1, 2, 3};

        key = 30

Output : Not found

 

Input : arr[] = {30, 40, 50, 10, 20}

       key = 10    

Output : Found at index 3

Problem approach
  • Firstly I told the interviewer a linear search approach, then he gave me a hint of binary search. Then after a lot of effort, I gave him and modified binary search approach and wrote its code and the interviewer was satisfied by my approach.
Try solving now

2. Connect n ropes with minimum cost

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

Connect n ropes with minimum cost

There are given n ropes of different lengths, we need to connect these ropes into one rope. The cost to connect two ropes is equal to the sum of their lengths. We need to connect the ropes with minimum cost.

 

For example, if we are given 4 ropes of lengths 4, 3, 2, and 6. We can connect the ropes in the following ways.

1) First, connect ropes of lengths 2 and 3. Now we have three ropes of lengths 4, 6, and 5.

2) Now connect ropes of lengths 4 and 5. Now we have two ropes of lengths 6 and 9.

3) Finally connect the two ropes and all ropes have connected.

 

Total cost for connecting all ropes is 5 + 9 + 15 = 29. This is the optimized cost for connecting ropes. Other ways of connecting ropes would always have same or more cost. For example, if we connect 4 and 6 first (we get three strings of 3, 2 and 10), then connect 10 and 3 (we get two strings of 13 and 2). Finally we connect 13 and 2. Total cost in this way is 10 + 13 + 15 = 38.

Problem approach

I used the priority queue based approach in this question. I inserted all elements in the minimum priority queue and then pop two minimum items from the priority queue and add them and push resultant addition in priority queue again and this step repeats until the size of priority queue is greater than one.

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 - 1
3 rounds | 5 problems
Interviewed by Amazon
3084 views
0 comments
0 upvotes
company logo
SDE - 1
4 rounds | 8 problems
Interviewed by Amazon
2294 views
1 comments
0 upvotes
company logo
SDE - 1
3 rounds | 6 problems
Interviewed by Amazon
1592 views
0 comments
0 upvotes
company logo
SDE - 1
4 rounds | 8 problems
Interviewed by Amazon
8962 views
0 comments
0 upvotes
Companies with similar interview experiences
company logo
SDE - 1
4 rounds | 5 problems
Interviewed by Microsoft
58237 views
5 comments
0 upvotes
company logo
SDE - 1
4 rounds | 8 problems
Interviewed by Samsung
12648 views
2 comments
0 upvotes
company logo
SDE - 1
4 rounds | 8 problems
Interviewed by Microsoft
5983 views
5 comments
0 upvotes