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

SDE - 1

Amazon
upvote
share-icon
3 rounds | 10 Coding problems

Interview preparation journey

expand-icon
Preparation
Duration: 3 months
Topics: Data Structures and Algorithms, CS core subjects specially OS, DBMS & CN, OOP principlesLow level system design.
Tip
Tip

Tip 1 : Practice a lot of DSA questions.
Tip 2 : Learn system design also.

Application process
Where: Campus
Eligibility: CGPA criteria was above 6.5 for all branches
Resume Tip
Resume tip

Tip 1: Should be of 1 page.
Tip 2: Mention projects along with important details in bullet forms.

Interview rounds

01
Round
Medium
Online Coding Interview
Duration150
Interview date24 Oct 2020
Coding problem2

It was on Amcat platform from 8 pm to 11 pm. We were allowed to login anytime between 8 pm and 8:3 to start the test. It was a proctored test. It consisted of 4 sections to be finished in 2.5 hours. 1st section was code debugging round were 6 questions were there to fix the bugs in the code within 10 minutes. I did in 4 minutes.

2nd section had 2 coding questions which had to be done within 70 minutes. One was related to merge two sorted Linked Lists and second question was Clone a linked List having random pointers. It was accepting only the optimized code.


I finishes 2nd section in 25 minutes. Thanks to coding Ninjas for help in practice.

3rd section had almost 50 behavioral questions which is to be finishes in 35 minutes.

4th section was an aptitude section consisting of 25 questions which was supposed to be finished in 35 minutes. Questions were mainly to check your analytical skills.

1. Merge Two Sorted Linked Lists

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

You are given two sorted linked lists. You have to merge them to produce a combined sorted linked list. You need to return the head of the final linked list.

Note:

The given linked lists may or may not be null.

For example:

If the first list is: 1 -> 4 -> 5 -> NULL and the second list is: 2 -> 3 -> 5 -> NULL

The final list would be: 1 -> 2 -> 3 -> 4 -> 5 -> 5 -> NULL
Problem approach

This was easy because I have solved it in codezen already. I used 2 pointers head and tail and initially they were NULL. Then I compared the head of 2 given linked lists and one which was smaller will be the new head of my sorted linked lists. Then I applied simple merge function of the merge sort while comparing elements and adding to my linked lists accordingly.

Try solving now

2. Clone a linked List having random pointers

Easy
10m average time
90% success
0/40
Asked in companies
MicrosoftUrban Company (UrbanClap)Amazon

Given a linked list having two pointers in each node. The first one points to the next node of the list, however, the other pointer is random and can point to any node of the list or null. The task is to create a deep copy of the given linked list and return its head. We will validate whether the linked list is a copy of the original linked list or not.

A deep copy of a Linked List means we do not copy the references of the nodes of the original Linked List rather for each node in the original Linked List, a new node is created.

For example,

example

Random pointers are shown in red and next pointers in black.

Problem approach

There are 2 solutions for it. I have used the optimized one. Created the copy of node 1 and insert it between node 1 & node 2 in original Linked List, create a copy of 2 and insert it between 2 & 3. I Continued in this fashion till the end, add the copy of N after the Nth node. Now I copied the random link in this way 

original->next->random= original->random->next;


Now I restored the original and copy linked lists in this way in a single loop.


original->next = original->next->next;
copy->next = copy->next->next;


Ensure that original->next is NULL and return the cloned list's head pointer.

Try solving now
02
Round
Medium
Video Call
Duration40
Interview date26 Oct 2020
Coding problem2

It was also a DSA round on Amazon Chime with an SDE-2 guy from amazon. It was for 40 minutes and he asked me to turn my web camera on and he shared a screen with me for code pair.

1. Longest Common Subsequence

Moderate
39m average time
0/80
Asked in companies
PayPalSliceShareChat

Given two strings, 'S' and 'T' with lengths 'M' and 'N', find the length of the 'Longest Common Subsequence'.

For a string 'str'(per se) of length K, the subsequences are the strings containing characters in the same relative order as they are present in 'str,' but not necessarily contiguous. Subsequences contain all the strings of length varying from 0 to K.

Example :
Subsequences of string "abc" are:  ""(empty string), a, b, c, ab, bc, ac, abc.
Problem approach

I told him 2 approach. One was based on sorting in nlogn time. He told me to optimize it. I did it in linear time using hashing. He was satisfied with it.

Try solving now

2. Longest Substring Without Repeating Characters

Moderate
20m average time
80% success
0/80
Asked in companies
AmazonInfo Edge India (Naukri.com)Oracle

Given a string 'S' of length 'L', return the length of the longest substring without repeating characters.

Example:

Suppose given input is "abacb", then the length of the longest substring without repeating characters will be 3 ("acb").
Problem approach

There are 3 ways to solve it. One is use 2 loops i,j from zero to length of the string. Check if string from i to j have unique character or not.

Try solving now
03
Round
Medium
Face to Face
Duration42
Interview date26 Oct 2020
Coding problem6

It was based on CS core subjects as well as 1 coding question based on dynamic programming. Interview was with one Amazonian who was an SDE 2 there.

1. Difference between User thread and Kernel thread.

Problem approach

To make concurrency cheaper, the execution aspect of process is separated out into threads. As such, the OS now manages threads and processes

Kernel-Level threads make concurrency much cheaper than process because, much less state to allocate and initialize. However, for fine-grained concurrency, kernel-level threads still suffer from too much overhead.

2. Why do we need dispatchers in short term scheduling?

Problem approach

When the processes are ready to execute, they are pushed into the ready queue. The short term scheduler runs in the CPU and is used for selecting a single process from the ready queue for execution. A process dispatcher gives control of the CPU to a process selected by the short term scheduler.

3. Difference between Round robin and SJF scheduling algorithms.

Problem approach

Shortest Job First (SJF) Scheduling Algorithm is based upon the burst time of the process. The processes are put into the ready queue based on their burst times. In this algorithm, the process with the least burst time is processed first. The burst time of only those processes is compared that are present or have arrived until that time. It is also non-preemptive in nature. Its preemptive version is called Shortest Remaining Time First (SRTF) algorithm.

 

Round-Robin (RR) Scheduling Algorithm is particularly designed for time sharing systems. The processes are put into the ready queue which is a circular queue in this case. In this case a small unit of time known as time quantum is defined. The algorithm selects the first process from the queue and executes it for the time defined by the time quantum. If the process has burst time less than the time quantum then the CPU executes the next process but if it has burst time higher than the time quantum then the process is interrupted and next process is executed for same time quantum. If a process is interrupted then a context switch happens and the process is put back at the tail of the queue. It is preemptive in nature.

4. Which is the best scheduling algorithms that you know?

Problem approach

It depends on the requirment.

5. Write a SQL query to find 3rd largest salary in a database

Problem approach

Select salary from employee order by desc limit 3,1

6. Dice Throws

Hard
35m average time
65% success
0/120
Asked in companies
MicrosoftDisney + HotstarShareChat

You are given D dice, each having F faces numbered 1 to F, both inclusive. The task is to find the possible number of ways to roll the dice together such that the sum of face-up numbers equal the given target S.

Note :
As the answer can be large, return your answer modulo 10^9  + 7.
Follow Up :
Can you solve this using not more than O(S) extra space?
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
58238 views
5 comments
0 upvotes
company logo
SDE - 1
4 rounds | 8 problems
Interviewed by Samsung
12649 views
2 comments
0 upvotes
company logo
SDE - 1
4 rounds | 8 problems
Interviewed by Microsoft
5983 views
5 comments
0 upvotes