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

SDE - 1

Amazon
upvote
share-icon
5 rounds | 8 Coding problems

Interview preparation journey

expand-icon
Preparation
Duration: 9 Months
Topics: C++,Data Structures and Algorithms, operating system,DBMS, computer network
Tip
Tip

Tip 1 : Focus on Data Structures and Algorithms skills
Tip 2 : Always prepare for Amazon behavioural Interview Questions

Application process
Where: Campus
Eligibility: 7 CGPA
Resume Tip
Resume tip

Tip 1 : Mention Projects to show your development skills 
Tip 2 : Be prepared with everything whatever you had mentioned on your Resume

Interview rounds

01
Round
Medium
Online Coding Test
Duration110 minutes
Interview date26 Jan 2022
Coding problem2

I got a link on 24 January and they give me time of 5 days to attend the test, anytime between these dates.

1. K Closest Points To Origin

Moderate
25m average time
75% success
0/80
Asked in companies
AppleFacebookAmazon

Your house is located at the origin of a 2-D plane. You have 'N' neighbours who live at 'N' different points on the plane. You want to visit exactly 'K' different neighbours who live closest to your house, you are given a 2 - D matrix 'POINTS'. So, find out the coordinates of the neighbours you are going to visit. The answer is guaranteed to be unique.

Note:

The distance between two points on a plane is the Euclidean Distance.
For Example:
If N = 2, K = 1 and the points are {2,3}, {-1, 2}.

Then the distance of the first point from the origin is sqrt((2 - 0) ^ 2 + (3 - 0) ^ 2) = sqrt(13).

The distance of the second point from the origin is sqrt((-1 - 0) ^ 2 + (2 - 0) ^ 2) = sqrt(5).
Follow Up:
Can you solve this in O(N log K) time complexity?
Problem approach

1- By reading the Question you will understand that here priority queue is used
2- I had calculated the distances from origin and maintain priority queue,which contain values of k closest point's and atlast store these points as result.

Try solving now

2. Maximum Consecutive Ones

Easy
0/40
Asked in companies
AmazonOlaZivost Technologies

You are given an array ‘ARR’ of length ‘N’ consisting of only ‘0’s and ‘1’s. Your task is to determine the maximum length of the consecutive number of 1’s.


For Example:
ARR = [0, 1, 1, 0, 0, 1, 1, 1], here you can see the maximum length of consecutive 1’s is 3. Hence the answer is 3.
Problem approach

This Question is based on Sliding window Approach.

Try solving now
02
Round
Hard
Face to Face
Duration60 minutes
Interview date16 Feb 2022
Coding problem2

This is Telephonic round, never expected that they ask in such a depth on this round

1. Serialize and Deserialize Binary tree

Hard
15m average time
85% success
0/120
Asked in companies
UbereBayApple

You have been given a binary tree of integers. You are supposed to serialize and deserialize (refer to notes) the given binary tree.


You can choose any algorithm to serialize/deserialize the given binary tree. You only have to ensure that the serialized string can be deserialized to the original binary tree.


Note :
Serialization is the process of translating a data structure or object state into a format that can be stored or transmitted (for example, across a computer network) and reconstructed later. The opposite operation, that is, extracting a data structure from stored information, is deserialization.
Problem approach

I had used level order traversal first, but was not accepted by Interviewer then I told him preorder traversal technique. Here first I had converted tree in string form and then again convert it in binary tree using stringstream and getline functions

Try solving now

2. K Closest Values

Hard
45m average time
55% success
0/120
Asked in companies
AppleAmazon

You have been given a Binary Search Tree of ‘N’ nodes, a real number ‘target’, and an integer ‘K’. Your task is to find exactly ‘K’ values from the given binary search tree that are closest(having the least absolute difference) to ‘target’.

A sample binary search tree

1

Note:
A Binary Search Tree is a binary tree data structure with the following properties:

The left subtree of any node contains nodes with a value less than the node’s value.

The right subtree of any node contains nodes with a value equal to or greater than the node’s value.

Right, and left subtrees are also binary search trees.

It is guaranteed that,
Values of all nodes in the given binary search tree are distinct positive integers.

There will be only one unique set of ‘K’ values in the binary search tree that is closest to the ‘target’.
Problem approach

I already faced similar problem in Online Assessment, so I solved it using priority queue and code it easily.

Try solving now
03
Round
Medium
Face to Face
Duration50 Minutes
Interview date16 Apr 2022
Coding problem1

1 Question is asked based on Dynamic Programming

1. Game of Stones

Easy
15m average time
85% success
0/40
Asked in companies
AmazonDunzoCoinbase

Given the count of total stones in a game. Two-player ‘Ale’ and ‘Bob’ are playing the game. Your task is to find who will win the game if both the players are playing optimally.

Rules of the game.

1. In a single turn, a player can choose a single stone or ‘even’ number of stones.

2. They will play alternatively, which means in the first chance ‘Ale’ will collect the stones, in second-chance ‘Bob’ will collect the stones. And always ‘Ale’ will start the game.

3. If any player is not able to take any stones then another player will win the game.

Problem approach

First I told him recursive and Memorization techniques to Interviewer and he is satisfied. After that, I told him greedy Approach which was failing for few test cases and I had taken lot of time to think DP Approach,but atlast I told him the gap technique of dp and solved the Question

Try solving now
04
Round
Medium
Face to Face
Duration60 Minutes
Interview date16 Apr 2022
Coding problem2

SDE-2 had taken this round, no behavioural questions, directly jump to coding section

1. Rearranging String

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

You have been given two strings ‘S’ and ‘W’. You need to rearrange ‘S' to obtain ‘W’ using the following operations:-

    If the length of the string is greater than 1:

  • Divide the string into two non-empty strings ‘X’ and ‘Y’ such that ‘S’ = ‘X’ + ‘Y’.
  • You can either swap two substrings or keep them in the same order, i.e., after this operation either S = ‘X’ + ‘Y’ or S = ’Y’ + ‘X’.
  • Apply the first step recursively on ‘X’ and ‘Y’.
    • If the length of the string is 1 then stop.

    Example:
    If ‘S’= “great” and ‘W’= “tagre”, ‘S’ can be rearranged to form ‘W’.
    
    ‘S’ = “gre” + “at” (We choose to swap ‘X’ & ‘Y’)
    ‘S’ = “at” + “gre” 
    Now letting “gre” as it is and applying operation on “at”.
    ‘S’ = “a” + “t” + “gre”
    Swapping “a” and “t”
    ‘S’ = “t” + “a” + “gre”
    Therefore ‘S’ can be rearranged into ‘W’. 
    
    Note:
    Both strings are of the same length and operations can only be applied to string ‘S’.
    
    Problem approach

    Told her hashmap and Priority queue Approach and she was satisfied with Solution

    Try solving now

    2. Alien Dictionary

    Hard
    46m average time
    50% success
    0/120
    Asked in companies
    AdobeFacebookInfo Edge India (Naukri.com)

    You have been given a sorted (lexical order) dictionary of an alien language.


    Write a function that returns the order of characters as a string in the alien language. This dictionary will be given to you as an array of strings called 'dictionary', of size 'N'.


    Example :
    If the dictionary consists of the following words:-
    ["caa", "aaa", "aab"], and 'K' is 3.
    
    Then, the order of the alphabet is -
    ['c', 'a', 'b']
    
    Note:
    If the language consists of four letters, the four letters should be the starting four letters of the English language. 
    
    However, their order might differ in the alien language.
    
    Problem approach

    When she told me this question, initially I don't understand the question, then she again told me and explain the problem in polite way. I got the Approach, topological sort and told her Approach, she ask few questions regarding topo sort,then asked me code Question and I coded it correctly.

    Try solving now
    05
    Round
    Easy
    Face to Face
    DurationThis is SDM round.
    Interview date2 May 2022
    Coding problem1

    Interviewer joined call after 5 minutes and he was also facing some network issues, I told him about this and he switch off his camera and ask me few behavioural questions, I had answered them as I was already prepared for them.
    Then,he moved to coding problem and wanting from me to directly write the code without explaining and Problem is quite hard, so I told him please give me little bit of time as I didn't get the problem in first go.
    But he was in hurry, didn't give me proper time and Over the Interview just after 35 Minutes.

    1. System Design Question

    Design Autosearch complete System

    Problem approach

    Told the Trie Approach and took time to come with this Approach as it was not a easy problem, but Interviewer was in hurry, so unable to code the problem.

    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