Amazon Interview Questions
- 0of 0 votes
AnswersDesign a movies reviews aggregator system. Data should be fetched from movie rating providers like imdb, rotten tomatoes, etc
- neer.1304 April 06, 2019 in United States| Report Duplicate | Flag | PURGE
Amazon SDE-3 System Design - 0of 0 votes
AnswersFind the sum of n elements after a kth smallest element in BST. Tree is very large, you are not allowed to traverse the tree.
- neer.1304 April 06, 2019 in United States| Report Duplicate | Flag | PURGE
Amazon SDE-3 Algorithm - 0of 0 votes
AnswersDesign subscription based sports website which can display scores, game status, history for any games hld and lld
- neer.1304 April 06, 2019 in United States| Report Duplicate | Flag | PURGE
Amazon SDE-3 design - 0of 0 votes
AnswersConsider an infinite stream of numbers. At any point print smallest k elements.
- neer.1304 April 06, 2019 in United States| Report Duplicate | Flag | PURGE
Amazon SDE-3 Algorithm - 0of 0 votes
AnswersGiven an array of integers(duplicates allowed) return if it is a set of contiguous integers or not?
- neer.1304 April 06, 2019 in United States
Input: 5,2,3,6,4,4,6,6 Output: Yes (as it is from set of [2,3,4,5,6])| Report Duplicate | Flag | PURGE
Amazon SDE-3 Algorithm - 1of 1 vote
AnswersGiven an array of integers with the property that arr[j] – arr[j-1] is either 1,0,-1 and a search value, provide an efficient search mechanism.
- neer.1304 April 06, 2019 in United States| Report Duplicate | Flag | PURGE
Amazon SDE-3 Algorithm - 0of 0 votes
AnswersGiven coin denomination of 3, 6 and 17, find the number of ways in which you can form a sum 'n'. How will do it for large numbers?
- neer.1304 April 06, 2019 in United States| Report Duplicate | Flag | PURGE
Amazon SDE-3 Algorithm - 0of 0 votes
AnswersThere is a huge road. Given are the following
- neer.1304 April 06, 2019 in United States
- Array D that stores the distance from a starting point where billboard can be installed.
- Array C that stores the profit. C[i] -> profit if the billboard is installed at distance D[i].
- dist -> minimum distance to maintain between the billboards.
Assume you can install any number of billboards while maintaining a given minimum distance 'dist' between each of them. Find the maximum profit you can achieve.| Report Duplicate | Flag | PURGE
Amazon SDE-3 Algorithm - 0of 0 votes
AnswersDesign an airport service that will be used to allocate a free runway when the plane is about to land. Data structure for the same. What if the runway is not available? Message passing between control centre and the plane. Focus on low-level design and code. Can the same runway be alloted to two different planes (locking)? Database storage needed?
- neer.1304 April 06, 2019 in United States| Report Duplicate | Flag | PURGE
Amazon SDE-3 design - 0of 0 votes
AnswersHow to find if a Binary tree has an odd number of nodes without using node count? Binary tree does not have to be balanced
- programmer March 29, 2019 in United States| Report Duplicate | Flag | PURGE
Amazon Backend Developer - 0of 0 votes
AnswersC program for the given two array as point of x and y
- Rising star March 18, 2019 in United States
int x[] = { 2,3,2,4,2};
int y[] = {2, 2, 6,5,8}; count the pair
maximum area coverd in x y plane
Ouput:3
From the above input there are five coordinates possible (2,2)(3,2)(2,6()(4,5)and (2,8) in which (2,2)(2,6)(2,8)that is three coodinaters covers the maximum area in x y plane
Input: x[] ={1,2,3}
Y[] = {1,2,3}
Output: 1
there are three coordinates (1,1)(2,2)(3,3)in which only one coordinates covers maximum distancethat is (1,3)| Report Duplicate | Flag | PURGE
Amazon Software Developer Algorithm - 0of 0 votes
AnswersProgram to print last element of matrix by traversing a matrix by anticlockwise starting from cell(1,1) and skiping alternate.
- Rising star March 09, 2019 in United States
Ex:
Input:1 2 3 4
2 4 5 1
7 9 6 2
3 5 2 7
Output: 5
Start traversing matrix from cell(1,1) skip next row element go to 3 row element again skip 4 element go to bottom of second column .....up to last element and print only last element.
If Input: 1 2
3 4
Output: 2
Input:1 2 3
4 5 6
7 8 9
Output: 5| Report Duplicate | Flag | PURGE
Amazon Software Developer - 0of 2 votes
AnswersFind numbers that formed from sring
- Rising star February 24, 2019 in United States| Report Duplicate | Flag | PURGE
Amazon SDE1 - 1of 1 vote
AnswersFind the indices of all anagrams of a given word in a another word.
- aonecoding4 February 19, 2019 in United States
For example: Find the indices of all the anagrams of AB in ABCDBACDAB (Answer: 0, 4, 8)| Report Duplicate | Flag | PURGE
Amazon Software Engineer - 0of 0 votes
AnswersWrite AWS lambda function to fetch data from on premises oracle db and migrate to aurora db.
I tried :var oracledb = require('oracledb-for-lambda'); var os = require('os'); var fs = require('fs'); 'use strict'; str_host = os.hostname() + ' localhost\n'; fs.appendFile(process.env.HOSTALIASES,str_host , function(err){ if(err) throw err; });
Can someone show me , i have table with same columns present in oracle db as well as aurora db i want to map form oracle to aurora. How to write it in java or python using aws lambda.
- Brucewratner February 04, 2019 in United States| Report Duplicate | Flag | PURGE
Amazon Backend Developer - 0of 0 votes
AnswersDesign a data scrubber.
- kumar February 01, 2019 in India
Say a customer couldn't use Alexa with Philips light bulb. Now customer calls to Alexa/Amazon customer support they figure out the issue is not with Alexa it's with the Philips LED bulb.
Now amazon will redirect their customer call / chat to third party customer support (Philips in this case).
Now somehow we need prevent the possibility of third party customer support trying to exploit our customers. For ex: asking their bank accounts, credit card, Social Security number etc..
How will you do that for AMAZON level ?| Report Duplicate | Flag | PURGE
Amazon SDE-2 System Design - 0of 0 votes
AnswersYou have oracle database table , and AURORA AWS table with same fields , write a java lambda function to migrate data from oracle table to aurora. Also it should be realtime, if a new record is added to oracle it should update aurora db table as well.
- Brucewratner January 29, 2019 in United States| Report Duplicate | Flag | PURGE
Amazon Backend Developer Java - 0of 0 votes
AnswersGiven an array of edges between any two points in 2 dimensional space. A single edge is represented by the co-ordinates of two points it is connecting for example (2,3),(4,5) represents and edge connecting points (2,3) and (4,5).Find out the total number of squares possible if all edges are parallel to X or Y axis.
- jadonv January 26, 2019 in United States
NOTE : Include overlapping squares, squares having one side in common and squares contained within another square. Co-ordinates can have float values.
Example below -
I have considered a very simple input and output combination to keep it short.
Input
{
(0,0),(0,3)
(0,0),(3,0)
(0,3),(3,3)
(3,0),(3,3)
}
Output : 1
Possible Approach : Create a map as below -
Key(Slope of Edge in Degrees) - Value(Array of Edges)
0 - {(0,0),(3,0)},{(0,3),(3,3)}
90 - {(0,0),(0,3)},{(3,0),(3,3)}
While inserting edges in the map, make sure the edges are sorted by max(x1,x2) first and then max(y1,y2).
Pick 2 edges from one slope let's say slope 0, then pick 2 edges from slope 90 and see if square is formed or not. If square not formed, then look at next 2 edges of slope 90 and so on.
Sorting here is an expensive operation.
Please share any better solutions.| Report Duplicate | Flag | PURGE
Amazon SDE1 Algorithm - 1of 1 vote
AnswersGiven a grid M x N cells having weight in each cell(any integer),
- keviIma January 15, 2019 in United States
For every path from TOP-LEFT to BOTTOM-RIGHT, find the minimum weight you come across.(Minimum per path.)
Now from all those minimum weights, find the Maximum.
You can move in all 9 directions.
Is this a trick question?| Report Duplicate | Flag | PURGE
Amazon - 2of 2 votes
AnswersGet the sum of all prime numbers up to N. primeSum(N).
- aonecoding4 January 07, 2019 in United States
Follow-up: If primeSum(N) is frequently called, how to optimize it.| Report Duplicate | Flag | PURGE
Amazon - -6of 6 votes
AnswersFind a pair that equals to the given target from the list of given two lists.
- sarunreddy82 January 07, 2019 in United States
example:
input:
target = 7
list1= [[1,2],[2,4[,[3,6]]
list2 = [[1,2]]
Output:[[2,1]]
Explanation: There are only three combinations [1,1],[2,1] and [3,1], which use a total of 4,6, 8 respectively. Since 6 is the largest use that does not exceed 7, [2,1] is the only optimal pair.
Example 2:
Input :
target = 10
list1 = [[1,3],[2,5],[3,7],[4,10]]
list2 = [[1,2],[2,3],[3,4],[4,5]]
Output;
[[2,4],[3,2]]| Report Duplicate | Flag | PURGE
Amazon Arrays - 1of 1 vote
AnswersPrroblem: write an algorithm to calculate the minimum cost to add new roads between the cities such that all the cities are accessible from each other
int numTotalAvailableCities = 6;
int numTotalAvailableRoads = 3;
int[,] roadsAvailable = { { 1, 4 }, { 4, 5 }, { 2, 3 } };
int[,] costNewRoadsToConstruct = { { 1, 2,5 }, { 1,3,10 }, {1,6,2} ,{ 5, 6, 5 } };
int numNewRoadsConstruct = 4;
- sunil.sebastian January 05, 2019 in United Statespublic class MinimumCostToConstructNewRoad { public static int getMinimumCostToConstruct(int numTotalAvailableCities, int numTotalAvailableRoads, int[,] roadsAvailable, int numNewRoadsConstruct, int[,] costNewRoadsConstruct) { int totalCost = 0; bool[] Visited = new bool[numTotalAvailableCities]; int[] Keys = new int[numTotalAvailableCities]; int[] Parent = new int[numTotalAvailableCities]; int[,] AdjMatrix = GetAdjecencyMatrix(roadsAvailable, costNewRoadsConstruct, numTotalAvailableCities); for (int i=0;i< numTotalAvailableCities;i++) { Keys[i] = Int32.MaxValue; } Keys[0] = 0; Parent[0] = -1; for(int i=0;i< numTotalAvailableCities-1;i++) { var u = FindMin(Visited, Keys); Visited[u] = true; for(int v=0;v< numTotalAvailableCities;v++) { if(Visited[v]==false && AdjMatrix[u, v]!=Int32.MaxValue && AdjMatrix[u,v]<Keys[v]) { Parent[v] = u; Keys[v] = AdjMatrix[u, v]; } } } for(int i=1;i< numTotalAvailableCities;i++) { totalCost = totalCost + AdjMatrix[Parent[i], i]; } return totalCost; } private static int FindMin(bool[] Visited, int[] Keys) { int min = Int32.MaxValue; int index = -1; for (int i = 0; i < Keys.Length; i++) { if (Visited[i] == false && Keys[i] < min) { min = Keys[i]; index = i; } } return index; } private static int[,] GetAdjecencyMatrix(int[,] roadsAvailable, int[,] costNewRoadsConstruct,int numTotalAvailableCities) { int[,] AdjMatrix = new int[numTotalAvailableCities, numTotalAvailableCities]; for (int i = 0; i < numTotalAvailableCities; i++) { for (int j = 0; j < numTotalAvailableCities; j++) { AdjMatrix[i, j] = Int32.MaxValue; } } int count = 0; for (int i = 0; i < roadsAvailable.GetLength(0); i++) { int start = roadsAvailable[i, count]-1; int end = roadsAvailable[i,count+1]-1; AdjMatrix[start, end] = 0; } for (int i = 0; i < costNewRoadsConstruct.GetLength(0); i++) { int start = costNewRoadsConstruct[i, count]-1; int end = costNewRoadsConstruct[i, count+1]-1; int cost= costNewRoadsConstruct[i, count + 2]; AdjMatrix[start, end] = cost; } return AdjMatrix; } }
| Report Duplicate | Flag | PURGE
Amazon SDE-2 Data Structures - 0of 0 votes
Answershow would you debug a tablet with a part of its touch screen is broken.
- rakshith18n December 31, 2018 in United States| Report Duplicate | Flag | PURGE
Amazon SDET - 1of 1 vote
AnswerGiven a series of equations e.g. [A = B, B = D, C = D, F = G, E = H, H = C]
- aonecoding4 December 25, 2018 in United States
and then another series [A != C, D != H, ..., F != A ]
Check whether the equations combined is valid.
For the example given, your program should return 'invalid', because the first series implies that A = C, which contradicts the statement A != C in the second series.| Report Duplicate | Flag | PURGE
Amazon Software Engineer - 0of 0 votes
AnswersImagine you have a computer keyboard that has all the letters mismatched
- klausv December 23, 2018 in United States
example:
typing q gives you a
typing w gives you b
all 26 letters in the alphabet are there, but typing one letter will give you another one
you are asked to write an algorithm to find whatever word you tried to type and count how many cycles you did to find the word
a restriction was set you need to type the whole word every time, not go character by character
note: a graph was suggested to represent the letter mappings| Report Duplicate | Flag | PURGE
Amazon SDE-2 Trees and Graphs - 1of 1 vote
AnswersHow to find out distinct ngrams from a email_alias.
- ashwini.padhy89 December 05, 2018 in India
For instance xyz@gmail.com here the email_alias is xyz.for xyz if we want to find bigram then function should have input the email_id,and the number of grams lets say 2.
Than it has to return the distinct count of ngrams present in the email_alias.| Report Duplicate | Flag | PURGE
Amazon SDE-2 Coding - 0of 0 votes
AnswersYou have two files in hdfs one having date range with two columns start date and end date and another having two column with date and visitors field. You have to write a spark code which gives date range having maximum no. of visitors using that two files.
- tokritijain October 30, 2018 in India| Report Duplicate | Flag | PURGE
Amazon Data Engineer - 0of 0 votes
AnswersGiven an array which represents columns, find the position of two columns which when removed will trap the maximum amount of water. This is related to trapping raining water problem.
- Ashish October 17, 2018 in India| Report Duplicate | Flag | PURGE
Amazon Software Developer - 0of 0 votes
AnswersGiven an unsorted array find the maximum distance between two elements satisfying the condition A[i] < A[j] where i < j. There will always be a solution.
- Ashish October 17, 2018 in India
For eg. 6, 9, 3, 2, 10, 2, 3| Report Duplicate | Flag | PURGE
Amazon Software Developer - -2of 4 votes
AnswersHow should I prepare for the interview with Alexa team at Amazon?
- ihsihs005 October 17, 2018 in United States for Alexa| Report Duplicate | Flag | PURGE
Amazon SDE1 Data Structures
Open Chat in New Window