Amazon Interview Questions
- 3of 3 votes
AnswersGiven the root of a Binary Tree along with two integer values. Assume that both integers are present in the tree.
- teli.vaibhav October 30, 2016 in United States
Find the LCA (Least Common Ancestor) of the two nodes with values of the given integers.
2 pass solution is easy. You must solve this in a single pass.| Report Duplicate | Flag | PURGE
Amazon SDE-2 Algorithm - 1of 1 vote
AnswersYou are given 2 lists -
List 1: List<Demand> is a list of Demand objects.
List 2: List<Supply> is a list of Supply objects.
Return a result fulfillment List<Demand,List<Supply>>.
This means each demand could be satisfied by more than one supplies.class Demand { Date startDate; Date expirationDate; int quantity; } class Supply { Date startDate; Date expirationDate; int quantity; }
The Demand and Supply refers to that of groceries. You must map supplies to a demand only if the supply still has at least 3 days remaining to its expiration before the demand can be fulfilled.
- teli.vaibhav October 30, 2016 in United States
A demand is said to be fulfilled 24 hours after all demands have been mapped to correspondingly available supplies.| Report Duplicate | Flag | PURGE
Amazon SDE-2 Algorithm - 2of 2 votes
AnswersGiven a string with only parenthesis. Check if the string is balanced.
- teli.vaibhav October 30, 2016 in United States
ex -
1) "<({()})[]> is balanced
2) "<({([)})[]> is not balanced| Report Duplicate | Flag | PURGE
Amazon SDE-2 Algorithm - -1of 1 vote
AnswerWrite code for the partition subroutine in Quicksort.
- teli.vaibhav October 30, 2016 in United States| Report Duplicate | Flag | PURGE
Amazon SDE-2 Algorithm - 1of 1 vote
AnswerHow would you Design a HashTable?
- teli.vaibhav October 30, 2016 in United States
In what ways would you attempt to address collisions?| Report Duplicate | Flag | PURGE
Amazon SDE-2 design - 2of 2 votes
Answersfind first not-repeating character by iterating through the length of the string only once and by using constant space.
- Raj October 28, 2016 in United States| Report Duplicate | Flag | PURGE
Amazon SDET Algorithm - 1of 1 vote
AnswersWe define an undirected graph g,such that: The total number of nodes in the graph is g_nodes. The nodes are numbered sequentially as 1,2,3….g_nodes. The total number og edges in the graph is g_edges. Each edge connect two distinct nodes(i.e no edge connect a node to itself). The weight of the edge connecting nodes g_to[i] and g_from[i] is g_weight[i]. We define the weight of the path from some start node to some end node to the sum of all edges traversed on the path. Input formate: The first line contain two space-seperated integer describing the respective value of g_node and g_edge. Each line I of the g_edge subsequent lines contain three space –seperated integer describing the respective value of g_to[i],g_from[i] and g_weight[i]. The next line contain an integer denoting start The next line contain an integer denoting end. The next line contain an integer denoting w_extra. input 1:
- zila.techy October 21, 2016 in India
4 4
1 2 2
2 3 1
2 4 2
3 4 3
1
4
5
Output:4
input2:
5 5
1 2 2
1 4 4
2 3 1
3 4 3
4 5 1
1
4
2
output:3
Int mincost(int g_nodes,int g_edged,int* g_from,int* g_to,int* weight,int start,int end,int w_extra)
{
}| Report Duplicate | Flag | PURGE
Amazon Developer Program Engineer C - 0of 2 votes
Answerswrite a SQL query to retrieve the number of students that received a GPA of 3 or 4. the query should return Total number of students that receive a GPA of 3 separate from Total number of students that receive GPA 4.
- aryan October 19, 2016 in United States
Schema:-
Student:- Student_ID, name, phoneno, email, gpa, gradyear
Classes: Class_ID, name, description
student_classes:- Class_ID, Student_ID, Grade| Report Duplicate | Flag | PURGE
Amazon Software Engineer Database - 1of 1 vote
AnswersDesign a service to generate unique 64 bit IDs
- kanukadze October 18, 2016 in United States| Report Duplicate | Flag | PURGE
Amazon Senior Software Development Engineer System Design - 0of 0 votes
AnswersGiven a set of numbers, find out all subsets of the set such that
the sum of all the numbers in the subset is equal to a target number.s = [ 1, 2, 3, 4, 5 ] target = 5 op = [ [ 1,4 ] , [2,3] , [5] ]
Application: Given a fixed budget, and work items we are doing back filling to check what all we can attain with the budget.
Continuation. Imagine the set is actually a set of work items, with cost and utility involved :def work_item : { name : 'foo bar' , cost : 10 , utility : 14 }
Now, solve this to maximise utility.
Continuation. Imagine that the work items are related, so that, if work item w1 is already in the
subset of the work items selected, w2 's utility increases further!.
( Can you imagine how it can happen? Effectiveness of Mesi increases when he plays for Barca)
So, you are given a list like this :w1 -> normal utility 14, with w2 20, ....
Now maximize payoff.
NOTE: Payoff is a matrix. This comes from game theory.
Hence, a payoff matrix looks like :w1 w2 w3 w4 .... w1 w1 w2 w2 w3 w3 w4 w4
A cell ( i,j) is filled up with if a list contains both wi and wj, then how much the payoff would be. It is a symmetric matrix.
- NoOne October 15, 2016 in United States| Report Duplicate | Flag | PURGE
Amazon SDE-3 Algorithm - 4of 4 votes
AnswersGiven that an external service gives a list of credit cards that have become fraud, design a fraud management system for a shopping website for bookings with fraud credit cards
- mesmerizing.memories123 October 14, 2016| Report Duplicate | Flag | PURGE
Amazon SDE-2 System Design - 0of 2 votes
AnswersGiven a list of shops each of which have a list of toys with their prices and max number of children who can play with it at a time. Output the a list of best possible toy option from each shop given the number of children who are shopping.
- mesmerizing.memories123 October 14, 2016 in India
ToyShopping
{
getListOfBestToysFromEachShop(List<Shop> shops);
}
Shop
{
int id,
List<Toy> listOfToys;
}
Toy
{
int toyId;
int shopId;
int price;
int maxChildren; //max number of children who can play with this toy
}| Report Duplicate | Flag | PURGE
Amazon SDE-2 Algorithm - 0of 0 votes
AnswersCAREERCUP is a boad game hat contains m x n on a board. The objective of the CAREERCUP game is to reach the bottom of he board (bottom right corner) from the top of the board (top left corner) while moving one grid at a ime in either the down, right or diagonally downwrd directions.
- J@sper October 11, 2016 in United States
Write a method called CareerSolution that takes in two integers representing m and n, and returns the total number of ways a player can complete the game.
PS: Was later asked to optimize the solution.
int CareerSolution(int m, int n) {
}| Report Duplicate | Flag | PURGE
Amazon Intern Arrays - 3of 3 votes
AnswersGiven an array of 1 billion numbers with just a few 100 missing, find all the missing numbers. you have only enough memory to store only 10k elements
- PS October 07, 2016 in United States| Report Duplicate | Flag | PURGE
Amazon Senior Software Development Engineer Algorithm - 0of 0 votes
AnswersDesign the classes for a Battleship Game. Write the attack function.
- Ray October 04, 2016| Report Duplicate | Flag | PURGE
Amazon SDE-2 Object Oriented Design - 14of 14 votes
AnswersWrite a program to check whether it is a valid binary tree or not. Check all test cases (e.g. No left Node case).
- Neelavan October 02, 2016 in United States| Report Duplicate | Flag | PURGE
Amazon SDE-2 Algorithm - 0of 0 votes
AnswersConsider that your office provides an app to book meeting rooms. You provide the start and end time of the meeting. The app list the available rooms for that slot and you select a room and confirm your booking.
- Coding Panda September 30, 2016 in United States
All meeting happen between 9am - 6pm.
Write a method for getAvailableRooms(startTime, endTime). Use appropriate data structures.| Report Duplicate | Flag | PURGE
Amazon SDE-3 Algorithm - 1of 1 vote
Answerscount the duplicates in a array of strings??
- manasa0930 September 29, 2016 in United States| Report Duplicate | Flag | PURGE
Amazon Testing / Quality Assurance Algorithm - 0of 0 votes
AnswersWrite test cases for refrigerator?
- manasa0930 September 29, 2016 in United States| Report Duplicate | Flag | PURGE
Amazon Testing / Quality Assurance Testing - 2of 4 votes
AnswersA frequent traveller collects all his travel tickets.
- rd22 September 24, 2016 in India
A ticket has only 2 attributes, Start Journey Location name and Destination Name. Example from Delhi to Mumbai.
At the end of the year, the traveller gets all his tickets together and tries to map his journey across the year. Print his travel route in a readable format. He does not remember his start location.
Edit: he can visit a location multiple times, and can also go back and forth a place several times.| Report Duplicate | Flag | PURGE
Amazon Algorithm - 0of 0 votes
AnswersSuppose there is a social networking site like Facebook. Every user gets some friend recommendations (i.e. People you may know!). Now, if there is a user A and he has 100 friends and each of his friends has got 5 other friends,A can get these 500 recommendations. But the condition is that he should only get the top 10 recommendations with whom he has the maximum number of mutual friends(If A and B are friends and B and C are friends, then A and C have a mutual friend, B). Suggest an efficient data structure for this and how to implement it. The implementation should be flexible as at any moment, any user can make new friends and he may also unfriend someone!
- manidam07 September 19, 2016 in India| Report Duplicate | Flag | PURGE
Amazon Software Developer Algorithm - 0of 0 votes
AnswerUser uploaded file in File container/storage --> Its parsed by 1 App and removed frim storage --> App having logs --> App stored data into database
- Mallikarjun Birajdar September 18, 2016 in India for Kindle
--> One User interface featching data from DB havinig fields Username, Report ID, ProductID --> This UserInterface also connected to Report Application.
ProductID came from file, ReportID generated in report.
User interface not showing any data so what could be the issue?| Report Duplicate | Flag | PURGE
Amazon Quality Assurance Engineer Trouble shooting - 0of 0 votes
AnswersProgram- Metrics- Find Kth position in metrics in N X N metrics in spiral form
- Mallikarjun Birajdar September 18, 2016 in India for Kindle| Report Duplicate | Flag | PURGE
Amazon Quality Assurance Engineer Programming Skills - 0of 0 votes
Answers"aabcbcbdcc" you can remove and shuffle characters, find the maximum length of string which forms palindrome.
- Mallikarjun Birajdar September 18, 2016 in India for Kindle
like "ccabdbacc"| Report Duplicate | Flag | PURGE
Amazon Quality Assurance Engineer Programming Skills - 0of 0 votes
Answers5. Search functionality not working in Amazon shopping application in smartphone but its working through website, how you will debug this?
- Mallikarjun Birajdar September 18, 2016 in India for Kindle| Report Duplicate | Flag | PURGE
Amazon Quality Assurance Engineer Trouble shooting - 0of 0 votes
Answers4. Generate Test data for below function Grade(Obtained marks, Total marks) having below grading system.
- Mallikarjun Birajdar September 18, 2016 in India for Kindle
0% to 40%= D grade
41% to 60%= C grade
61% to 80%= B grade
81% to 100%= A grade
Grading calculation=Grade(20,40)=100*(20/40)= C grade| Report Duplicate | Flag | PURGE
Amazon Quality Assurance Engineer Testing - -1of 1 vote
Answers3. Write a program to display numbers having sum of left side numbers equal to right side numbers.
- Mallikarjun Birajdar September 18, 2016 in India for Kindle
{1,0,-11,1,12}=>0 {Left side number 1+0=1, Right side number -11+1+12=1}| Report Duplicate | Flag | PURGE
Amazon Quality Assurance Engineer Programming Skills - 0of 0 votes
Answers2. Write a program to diplay a character occurred maximum times and if two charaters occurring same no of times then display 1st character in string.
- Mallikarjun Birajdar September 18, 2016 in India for Kindle
"HELLO WORLD!" display L
"HO HELLO!" display H (H, L and O appeared 2 times but H is in 1st in string)| Report Duplicate | Flag | PURGE
Amazon Quality Assurance Engineer Programming Skills - 0of 0 votes
Answers1. "Unified search" for Email App, Web content and for SDCARD/Internal memory, which search word, letter and display result.
- Mallikarjun Birajdar September 18, 2016 in India for Kindle
Its a smartphone app. Write the test case for this.| Report Duplicate | Flag | PURGE
Amazon Quality Assurance Engineer Testing - 2of 2 votes
AnswersDesign a logging system. The system contains multiple application servers which are logging the information to file system. In this scenario, we want to check and alarm in case an exception is thrown in any of the servers. We want a system that checks for appearance of specific words, "Error", "Exception", "Disk Full" etc. in the logs of any of the servers. How would you design this system?
- jay September 17, 2016 in India
What if we want to scale the system in future?| Report Duplicate | Flag | PURGE
Amazon SDE-2 System Design