Open In App

Amazon Interview Questions | Set 146

Last Updated : 26 Jun, 2019
Improve
Improve
Like Article
Like
Save
Share
Report

I am happy to contribute to a community that helped me learn so much 🙂 This mail contains info about a recent interview I had with Amazon.

First round

Question 1

Problem statement: Given an Amazon reviews paragraph containing several words, find the minimum distance between two given words.

Example: Following is a hypothetical paragraph in an amazon review –

“Amazon is the best company to work for. The amazon is a beautiful forest.”

Find the minimum distance between ‘Amazon’ and ‘The’

Given: You are given the position of each word in the paragraph. Meaning, you know that word ‘Amazon’ occurs at positions 1 and 10, and ‘The’ occurs at 3 and 9. You do not have to parse the paragraph to gather this info.

Sub questions :
*Which data structure will you use to store the given info?
*Compute the minimum distance in the most efficient way.
*Give a working code for the same.

Question 2
Problem statement: In a binary tree, a chain can be defined as sum of length of the left node series, right node series, and 1. Find the length of longest chain in the tree.
Example: Refer to the image given below –

Chain length of node 1 = 3 + 2 + 1 = {count of 3 corresponds to node 2 , node 4, node 8 ; count of 2 corresponds to node 3, node 7 ; 1 corresponds to node 1 itself}
Similarly, chain length of node 2 = 2 + 1 + 1
The max chain length here is of node 1 which is 5. So, the output should be 5.
tree

Sub questions:
* Provide a solution, optimize it, give a working code or pseudo code or an algorithm for the same.

Second round

Question 1: Given two valid dictionary words, find the minimum number of steps required to transform first word to second word. Following are the transformation rules –

1. You can, in a single step, change a single letter in the word.
2. Each transition should result in a valid word. Assume you have been provided a helper function boolean isValid (String word) which tells you if a word is valid or not.
3. This must be done with minimum transitions.

Example: Transform CAT to TOY. One of the several possible transformations is CAT -> CAR -> TAR -> TOR -> TOY

Question 2 : Assume you have been given a binary tree such that the angle between horizontal and the line joining node to it’s left child (or right child) is 45 degree. This essentially means node 5 and 6 in the tree figure above collapse into a single node. A vertical for a tree is defined as shown in the figure below. Given a binary tree of the kind defined above, find the number of verticals that can be drawn.

Example: Refer to the diagram below to get an idea on verticals.
vertical-tree
?
Sub questions:
* Provide a solution and also provide a working code for the same.


Previous Article
Next Article

Similar Reads

Microsoft IGD Interview Experience | Set 146 (On Campus)
Round 1: Aptitude Round It consisted of 4 sections namely General Aptitude (20 minutes, 20 questions), Technical Aptitude (20 minutes, 20 questions), Coding (1 hour, 2 questions), and Written English Test (20 minutes, 1 essay of 150-180 words).  Since there was no negative marking, it was advisable to attempt all the questions.  In the General and
6 min read
Amazon Interview Questions | Set 147
Written round: 1- Given a sorted array.Make a balanced binary tree from this array. 2- A row and column wise 2d sorted array is given which only contains 0s and 1s in each row. Find the row which is having maximum number of ones. 3- Find the next greater elements in array. Face to Face 1 1- Given a row and column wise 2d sorted array. FInd an eleme
3 min read
Amazon’s most frequently asked interview questions | Set 2
Amazon's Most Frequently Asked Questions | Set 1 Level - Easy Get minimum element from the stack - Practice hereSerialize and deserialize a binary tree - Practice herePrint a binary tree in a vertical order - Practice hereCelebrity problem - Practice hereLevel order traversalSwap the kth element from starting and from the end position - Practice he
2 min read
Amazon Interview Experience SDE-1 | Amazon-WOW 2020
4 Technical rounds: First Technical Round: 1. Given two arrays and we need to find whether one array is a subset of other or not Ex: array1: 1 6 5 array2: 1 4 7 3 5 6 o/p: yes 2. Given a matrix and there will be bombs in the cells, find the number of blasts. A group of connected bombs leads to blast. 3. Level order traversal of a tree. Second Techn
2 min read
Amazon SDE-1 Interview Experience | Amazon WOW-2020
Online Test: The first round contain easy to medium questions. The online test consists of 28 MCQs in which there were general aptitude questions, OOPS, output, Data structure etc. In addition to this, there were 2 coding questions. Q1). https://www.geeksforgeeks.org/counting-inversions Q2).Find the position of leftmost and the rightmost set bit, a
2 min read
Amazon Interview Experience for SDE-1 | Amazon-WOW 2020
Amazon has a special program called AmazonWOW for women. It is to promote women in technology. It is a very good opportunity for women as they have to only compete with other females, not with males. The online application came in April. The program consists of a two-month internship for prefinal year student and fulltime plus Internship for final
8 min read
Amazon Interview Experience for SDE-1 (Amazon Wow drive)
I applied for role of SDE I through Amazon WOW drive 2020. There were a total of 5 rounds (1 coding test + 4 interviews). Originally interviews were supposed to be offline but because of coronavirus pandemic, I gave my interviews online. Round 1: Round 1 was online coding round consisting of 2 coding questions and 28 MCQs based on C, C++, Java, dat
5 min read
Amazon Interview Questions
Most Asked Questions K largest elements from a big file or array. Find a triplet a, b, c such that a2 = b2 + c2. Variations of this problem like find a triplet with sum equal to 0. Find a pair with given sum. All such questions are efficiently solved using hashing. - Practice here Binary tree traversal questions like left view, right view, top view
2 min read
Amazon telephonic interview questions for SDE 1
Ques1. Find top 10 selling product given the count of sales of each product. Ques2. Design a valet parking lot with basic use-case of assigning ticket to customer and retrieving the car later. Three sizes available. Use best fit and nearest distance. All Practice Problems for Amazon !
1 min read
Amazon SDE Sheet: Interview Questions and Answers
Amazon SDE sheet is the collection of the most important topics or the most frequently asked question in Amazon Software Development Engineer Interviews. Here we have collected all the interview questions and answers to land a job on Amazon table{ display: inline-table !important; width: 100% !important; } th:nth-child(2) { width: 20% !important; }
11 min read