Amazon Interview Experience (SDE-1)| Off-Campus | Recruitment Drive

• Difficulty Level : Hard
• Last Updated : 07 Jan, 2020

Hi All, Amazon conducted a drive for both SDE-1 and SDE-2 in July 2019 in Pune.I applied for the SDE-1 position.I got a call from a recruiter who specifically told me to brush up my coding and data structure fundamentals and told me to practice on paper.

Round 1:

The first round was coding test on paper . We were asked to write code on paper for three questions.

1)When you ask Alexa “buy bananas”, we query different catalouges (Prime, Whole Foods, Pantry etc).Each one of these come back with a sorted list of items that we need to merge together to have only one list.Write a function to merge the results and display top 10 items.Also mention the time and space complexity of your solution.

This question was similar to Merge K- sorted list when you can use the Priority Queue for maintaing top 10 items.

2)Given a tree of management chain of a company.Print the names if each employee who has specified number if reportees in the chain.

Pic of management tree

Input: 1

Output:

Lannister

Bronn

3)Implement a function to block a meeting room for a given time window.The meeting room cannot be booked for overlapping sessions.

Input:(11:00, 13:30)

Output:

Meeting booked(If no conflict with all existing meetings)

Meeting rejected(If conflict with any existing already booked meeting)

After an hour, they annouced the result for the written round.

Round 2:

In this round the interviewer asked 4 questions .

2)You are given n socks and color of each socks.You are also given the description of which socks to wear on which day.Find the minimum number of socks whose color have to be changed so that you the two socks color at each day must be same.

Example:

Color: 2 3 1 4 5

Sock : 1 2 3 4 5

Day – Sock no

1     –   2, 3

2    –   1, 5

3    –   2, 4

Find minimum number of socks whose color we can change so that at any day both socks color is same.

This question can be solved by assuming the particular day socks as an edge of a graph.

4)Find number of connected components in a graph.

https://www.geeksforgeeks.org/connected-components-in-an-undirected-graph/

Round 3:

In this round i was asked about my experience of working on microservices and the use  case of cache which i used in my project.

He asked me the Spring Boot Framework basic principles and difference between the Spring and Spring Boot.

He asked me to write a code to generate a random without using Java.lang.

Round 4:

In this round the interviewer asked me questions on design.

1)Consider there are logs which consists of sequence of webpages visited by a customer.We have to find the most occurring sequence  of length k in the sequence of web pages of all customers.

Example:

Log 1- p1->p2->p3>p4->p5…

Log2- p3->p4->p8…

Log3- p2->p3->p10…etc

so p2->p3 will be the most occurring sequence of web pages  of length 2.

He also asked how can i handle a sync when different log files are coming from different hosts in a system.

2)Consider there is a book . I was asked to write code to find the min/max distance between an occurrence of a word in the book(distance here means the number of pages)

He asked me to write a data structure to define a book and the other data structure for defining an index as well.

My Personal Notes arrow_drop_up