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

Amazon

5 rounds | 9 Coding
problems

Journey

I am from cse background. In the college last , I joined coding ninjas c++ course for preparation. This course helped me in understanding basics of language and syntax. After this course i am able to crack multiple companies. During my preparation i followed leetcode and some youtube courses.

Application story

Amazon visited our campus for placements. There were total 5 round in the interview. Application was done through placement cell of our college and the process was very smooth.

Why selected/rejected for the role?

I was selected in the interviews as I had prepared well. Also I did not lose my confidence when I saw others losing hope.

Preparation

Duration: 4 months

Topics: Data structures and Algorithms, Computer fundamentals subjects. Basics of every skill that you have written in your resume and also knowledge of concepts related to your projects. You should know whatever you have written in your resume.

Tip

Don’t create panic in any case in the interview , as even if you are not selected you will learn a lot from your interview experience and perform well in the future. Also I would recommend you Coding Ninjas as according to me it is a good platform to learn basic coding concepts and to practice coding.

Application process

Where: Campus

Eligibility:

Resume tip

Write whatever you are sure about and have actually done that. CGPA plays a good role but not a complete role as it is just eligibility criteria for some companies. Have at least 1 or 2 good projects from which you know everything involved in the project.

01

Round

Easy

Online Coding Test

Duration90 minutes

Interview date2 Aug 2019

Coding problem2

This round consist of two questions and we have to solve both the questions to qualify for the next round.

Count number of occurrences (or frequency) in a sorted array

Given a sorted array arr[] and a number x, write a function that counts the occurrences of x in arr[].

Examples:

Input: arr[] = {1, 1, 2, 2, 2, 2, 3,}, x = 2

Output: 4

2 occurs 4 times in arr[]

Problem approach

- Linear search solution was not working there as they are expecting less than O(n) complexity, so I solved this using binary search by finding the first and the last occurrence of element and subtracting them which will give the required answer.

Given an array and an integer K, find the maximum for each and every contiguous subarray of size k.

Examples :

Input: arr[] = {1, 2, 3, 1, 4, 5, 2, 3, 6}, K = 3

Output: 3 3 4 5 5 5 6

Explanation:

Maximum of 1, 2, 3 is 3

Maximum of 2, 3, 1 is 3

Maximum of 3, 1, 4 is 4

Maximum of 1, 4, 5 is 5

Maximum of 4, 5, 2 is 5

...

View more

Problem approach

- In this question as constraints were high so simple brute force was not working so used Deque data structure to solve this question.

02

Round

Easy

Face to Face

Duration40 minutes

Interview date3 Aug 2019

Coding problem1

A single coding question was asked that had a lot of corner cases.

Convert a given number into words for news reading by a device.

Example :

If the given input is 62, the output should be 'Sixty two' (without quotes).

Problem approach

- The solution involved concepts like Hash Maps & arrays. I was asked to write down the complete code after discussing the approach with the interviewer. She read the complete code, ran through a test case and it worked on pen and paper.

03

Round

Easy

Face to Face

Duration45 minutes

Interview date3 Aug 2019

Coding problem3

It had 3 coding questions followed by basic concepts of DP.

Converting a min heap to a max heap. There can be multiple max heaps possible. Any max heap will be good.

Problem approach

- I just simply use the concept of building heap in given array which was in O(n) time complexity, so interviewer got satisfied by my approach.

You have been given stock values/prices for N number of days. Every i-th day signifies the price of a stock on that day. Your task is to find the maximum profit which you can make by buying and selling the stocks.

Problem approach

- I gave him a brute force approach first and then told him a stack approach based on local maxima and minima.

To find the maximum difference between a node and its descendent in the same path in the binary tree.

Problem approach

- I was a little confused in this question but then thought of using recursion so gave interviewer tree traversal solution using recursion by calculating minimum from left and right subtree and keeping the maximum difference in answer variable.

04

Round

Easy

Face to Face

Duration30 minutes

Interview date3 Aug 2019

Coding problem2

It had 2 coding questions which were of good level.

Implement a data structure that can perform insertion, deletion, searching in constant time.

Problem approach

- I implemented hashmap using hashing with chaining technique which I already prepared before the interview.

Find an MST from a given graph by using Kruskal algorithm.

Problem approach

- I gave him the Kruskal algorithm solution. So he asked me to write the algorithm for that and to dry run that on a particular example. I gave him a crystal clear explanation with dry running it on a particular example.

05

Round

Easy

Face to Face

Duration30 minutes

Interview date3 Aug 2019

Coding problem1

This was the last round.

You are given a Singly Linked List which contains a series of integers separated by ‘0’.

Between two zeroes, you have to merge all the nodes lying between them into a single node which contains the sum of all the merged nodes. You have to perform this in place.

Problem approach

- I gave approach by maintaining sum between all the zeros. Whenever i encounter a zero, i calculated the sum of all the elements that had come before the last zero. In parallel, i keep changing the linked list as well.

Here's your problem of the day

Solving this problem will increase your chance to get selected in this company

Is method overloading possible by changing the return type?

Similar interview experiences

SDE - 1

3 rounds | 5 problems

Interviewed by Amazon

0 views

0 comments

0 upvotes

SDE - 1

4 rounds | 8 problems

Interviewed by Amazon

927 views

1 comments

0 upvotes

SDE - 1

3 rounds | 6 problems

Interviewed by Amazon

312 views

0 comments

0 upvotes

SDE - 1

4 rounds | 8 problems

Interviewed by Amazon

561 views

0 comments

0 upvotes

Companies with similar interview experiences

SDE - 1

4 rounds | 5 problems

Interviewed by Microsoft

47692 views

5 comments

0 upvotes

SDE - 1

4 rounds | 8 problems

Interviewed by Samsung

10705 views

2 comments

0 upvotes

SDE - 1

2 rounds | 4 problems

Interviewed by Google

9128 views

0 comments

0 upvotes

Comment Removed