Amazon Interview Questions
- 0of 0 votes
AnswersSome questions about how to write a immutable class.
- yankeson2013 February 08, 2017 in United States| Report Duplicate | Flag | PURGE
Amazon Software Engineer - 0of 0 votes
AnswersFind top n cities which got most orders. For example, amazon got a list of orders, and these orders will be shipped to different cities.
- yankeson2013 February 08, 2017 in United States| Report Duplicate | Flag | PURGE
Amazon Software Engineer Algorithm - 6of 6 votes
AnswersQ: If you were given a series of equations e.g. [A = B, B = D, C = D, F = G, E = H, H = C]
- aonecoding January 27, 2017 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 Algorithm - 1of 1 vote
AnswersYou are given an array of integers(with all valid input) You have to write a function which will produce another array, where the value in each index of the array will be the product of all values in the given array accept that index.
- Azarbaizan January 10, 2017 in United States for Market Place
Example
Array 1: 1 2 3 4 5
Array 2: 120 60 40 30 24.
Come up with a solution of O(n^2) can you improve it?| Report Duplicate | Flag | PURGE
Amazon Software Engineer Arrays - 1of 1 vote
AnswersGiven a binary tree and a target number, return whether or not there exist a path that can create target number. All inputs are integers. Target is not a string.
- cool November 22, 2016 in United States
NOTE:: this is not path sums to target number
ex:
3
4 5
6 7 8 9
359 = return true
38 = return false
47 = return true
6 = return true| Report Duplicate | Flag | PURGE
Amazon Software Engineer Algorithm - 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 - 0of 0 votes
AnswersTime Complexity ?
- Ragesh September 02, 2016 in United States for Seattle
a. Inserting a node in Linked List?
b. HashMap time complexity?| Report Duplicate | Flag | PURGE
Amazon Software Engineer - 0of 0 votes
AnswersFind missing number from sequence of numbers in an array? Time Complexity?
- Ragesh September 02, 2016 in United States for Seattle| Report Duplicate | Flag | PURGE
Amazon Software Engineer - 0of 0 votes
AnswerTime Complexity ?
- Ragesh September 02, 2016 in United States for Seattle
a. Inserting a node in Linked List?
b. HashMap time complexity?| Report Duplicate | Flag | PURGE
Amazon Software Engineer Algorithm - 0of 0 votes
AnswersFind missing number from sequence of numbers in an array? Time Complexity?
- Ragesh September 02, 2016 in United States for Seattle| Report Duplicate | Flag | PURGE
Amazon Software Engineer Algorithm - 0of 0 votes
AnswersReverse a String using Recursion and unit tests?
- Ragesh September 02, 2016 in United States for Seattle| Report Duplicate | Flag | PURGE
Amazon Software Engineer Algorithm - 0of 2 votes
AnswersGiven a list of numbers of odd length, design an algorithm to decide whether it's possible to remove any number from the list and split the remaining numbers into two sets of equal length with the same sum.
- jakeb July 22, 2016 in United States
Example:
Input: [1, 1, 1, 1, 1]
Output: Yes
Input: [1, 2, 2]
Output: No| Report Duplicate | Flag | PURGE
Amazon Software Engineer Algorithm - 0of 0 votes
AnswersHow to calculate sum of all numbers in a string. Example 11aa22bb33dd44 =110
- rageshpayyan July 21, 2016 in United States for Seattle
Note: Should not use Regex and replace| Report Duplicate | Flag | PURGE
Amazon Software Engineer Algorithm - 0of 0 votes
AnswersThere is an input log file given as follows-
- theconqueror July 06, 2016 in United States
log = [
{ 'user': 'A', 'page': 1},
{ 'user': 'B', 'page': 5},
{ 'user': 'A', 'page': 2},
{ 'user': 'A', 'page': 1},
{ 'user': 'B', 'page': 2},
{ 'user': 'C', 'page': 7},
{ 'user': 'C', 'page': 3},
{ 'user': 'A', 'page': 3},
{ 'user': 'C', 'page': 1},
]
please implement
discover_site_map(log)
discover_site_map returns a representation of the links between pages, using whatever data structure you think is suitable:
1 -> 2, 3
2 -> 1
3 -> 1
5 -> 2
7 -> 3
How to solve this in C++ and Python?| Report Duplicate | Flag | PURGE
Amazon Software Engineer - 0of 0 votes
AnswersYou have rating (0-10) of the hotels per user in this format:
- theconqueror July 06, 2016 in United States
scores = [
{'hotel_id': 1001, 'user_id': 501, 'score': 7},
{'hotel_id': 1001, 'user_id': 502, 'score': 7},
{'hotel_id': 1001, 'user_id': 503, 'score': 7},
{'hotel_id': 2001, 'user_id': 504, 'score': 10},
{'hotel_id': 3001, 'user_id': 505, 'score': 5},
{'hotel_id': 2001, 'user_id': 506, 'score': 5}
]
Any given hotel might have more than one score.
Implement a function, get_hotels(scores, min_avg_score) that returns a list of hotel ids that have average score equal to or higher than min_avg_score.
get_hotels(scores, 5) -> [1001, 2001, 3001]
get_hotels(scores, 7) -> [1001, 2001]
*/
How to solve this in C++ and Python?| Report Duplicate | Flag | PURGE
Amazon Software Engineer Algorithm - 0of 0 votes
AnswersEliminate all the anagrams from an Array of 100 Strings!
- PS May 26, 2016 in United States| Report Duplicate | Flag | PURGE
Amazon Software Engineer Algorithm - 1of 1 vote
Answershow can i merge 2 nodes in a graph in 1 node , need to save the in and out edges and the nodes that was merged for contribution after that
- KabhaD82 January 30, 2016 in United States
for example a graph implementation in adj list:
1->3->4->6
2->3->4->6
5->4->6
and i want to merge the nodes 3 and 4 , then new nodes should be created 7 as :
1->7->6
2->7->6
5->7->6
7->6
the node 7 also will save [include 3,4 the merged nodes]
any one can help with that please
typedef struct AdjListEntry {
int visited;
int index;
struct AdjListNode current; // node iniformation
struct AdjListEntry* next;
} AdjListEntry;
typedef struct AdjListNode {
int Uind;
char name[10];
char label[10];
adjOutEddgeLists *outEddges;
//adjInEddgeLists *inEddges;
} AdjListNode;
typedef struct adjOutEddgeLists{
AdjListNode *listNode;
adjOutEddgeLists *next;
}adjOutEddgeLists;| Report Duplicate | Flag | PURGE
Amazon Software Engineer C - 1of 1 vote
Answerscreate palindrome in javascript, by appending a minimum set of characters at the end.. eg. test => testset
- codebind December 19, 2015 in United States| Report Duplicate | Flag | PURGE
Amazon Software Engineer - 0of 0 votes
AnswersAt regular interval, we are receiving data (Price,Quantity). We need to find Most Sold Price(MSP). Need to design the solution to print the current MSP with total Qty of that price, every time a set of price and its quantity sold is provided as input.
Time Price Qty MSP(Total Qty) 11:01AM $10.01 100 $10.01(100) 11:03AM $11.01 200 $11.01(200) 11:04AM $12.81 150 $11.01(200) 11:06AM $10.01 210 $10.01(310) 11:07AM $10.01 180 $10.01(490) 11:08AM $12.81 400 $12.81(550) 11:09AM $11.01 200 $12.81(550)
In the interview, I wrote a solution using priority queue where each element of the priority queue is a tuple consisting of price and quantity. The priority queue arranges itself based on the quantity value of each tuple. When new value comes we access the tuple having the particular price, retrieve its quantity. Delete this tuple and insert a new tuple with the same price and updated quantity.
- Edd November 24, 2015 in United States
The interviewer was not satisfied with the solution and commented this is not how a large scale application will be build which is running throughout the day.| Report Duplicate | Flag | PURGE
Amazon Software Engineer Algorithm - 0of 0 votes
AnswersHow would you implement X-ray for Kindle? X-ray is an index of characters in a book that shows how often a character appears in the book, and at which places. I was explained how this index works, and what it will look like on the book. There re more details here: http://www.amazon.com/gp/help/customer/display.html?nodeId=200729910
- ravishchawla September 10, 2015 in United States| Report Duplicate | Flag | PURGE
Amazon Software Engineer Algorithm - 0of 0 votes
AnswersGiven a 2-dimensional square matrix, rotate the matrix clockwise. Imagine concentric circles. Input from stdin: first line is length, subsequent lines are rows of the matrix. Output the matrix to stdout. This was one of the questions. You have 2 hrs to complete it.
- Yev September 02, 2015 in United States| Report Duplicate | Flag | PURGE
Amazon Software Engineer Java - 0of 0 votes
AnswersCompany will start a new marketing campaign targeting the users according
- JavaBuddy August 22, 2015 in United States
to their purchasing profiles.
This campaign has 3 kinds of messages each one targeting one group of customers:
Message 1 - targets the 25% of customers that spend most at the site
Message 2 - targets the 25% of customers that spend least at the site
Message 3 - targets the rest of the customers.
Given the list of purchases made during the week, write a program that lists
what kind of message each customer will receive.
Each purchase in this list features the customer id, the purchase amount among other information.| Report Duplicate | Flag | PURGE
Amazon Software Engineer Algorithm Java - 1of 1 vote
AnswersWrite a function which does zig-zag traverse of binary tree and prints out nodes.
- Eugene July 16, 2015 in United States
Example:
1
2 3
4 5 6 7
Output: 1, 2, 3, 7, 6, 5, 4| Report Duplicate | Flag | PURGE
Amazon Software Engineer - 1of 1 vote
AnswersA car rental company which rents car by per hour basis
- Goodprodd July 14, 2015 in United States
wants to know the time period for maximum number cars that are rented. ie you are given the list of rental start time and return times of all rented cars in the day for all cars in a day find the maximum time period in which cars are on the road.| Report Duplicate | Flag | PURGE
Amazon Software Engineer Algorithm - 0of 0 votes
AnswersWrite a function to print unique rows of a matrix.
- ritwik_pandey July 13, 2015 in India
I am thinking of a 0(n) solution for this (if possible).
I am storing the rows of the matrix in a set of vectors and then printing those rows. Please tell me how to do this and the correct time complexity for that. I am not very good with STL.| Report Duplicate | Flag | PURGE
Amazon Software Engineer Matrix - 3of 3 votes
AnswersPrint the level of friendship.
- AnonD June 24, 2015 in United States
Given a person and list of his friends, print all his friends by level of association.
The text file will be like one below
A: B,C,D
D: B,E,F
E: C,F,G
If the input is A, the out put should be:
Level 1 - B,C,D
Level 2 - E,F
Level 3 - G| Report Duplicate | Flag | PURGE
Amazon Software Engineer Algorithm - 0of 0 votes
AnswersSuppose you are given a puzzle that is represented as a matrix with 0s and 1s, where a 0 indicates you’re allowed to move into that position and 1 means you’re not allowed to move in that position. Write a function that given a start position and an end position, returns a boolean value indicating if there exists a path from start to end. you are only allowed to move up, left, right and down. Diagonal movement is not allowed.
- anom May 28, 2015 in United States
Example #1
Input
0 0 1 0 1
0 0 0 0 0
0 1 1 1 1
0 1 1 0 0
start: 4,1
end 0,3
Output - true
Example #2
Input
0 0 1 1 1
0 1 0 0 0
1 1 1 1 1
0 0 0 0 1
start: 0,0
end: 1,2
Output - false| Report Duplicate | Flag | PURGE
Amazon Software Engineer - 3of 3 votes
AnswersThere are N pots. Every pots have some water in it. They may be partially filled. So there is a Overflow Number 0 associated with every pot which tell how many minimum stone pieces are require for that pot to overflow. So if for a pot 0-value is 5 it means minimum 5 stone pieces should be put in that pot to make it overflow. Initially a crow watched those pots and by seeing the water level he anticipated 0-value correctly for every pot ( that is he knew 01 to On). But when he came back in evening he found that every pot is painted from outside and he is not able to know which pot has what 0-value. Crow wants some K pots to overflow so that he can serve his child appropriately. For overflow of pots he need to search for stone in forest( assume that every stone has same size). He wants to use minimum number of stones required to overflow K pots. But only he know the 0-value of pots he doesn't know now which pot has what 0-value. So the task is that in what minimum number of stones he can make K pots overflow in worst case.
- veeru April 29, 2015 in India for Development
Input/Output Specifications Input Specification: 1) A array 0 corresponding to 0-value of N pots {01, 02, On} 2) Number of pots 3) K -value ( number of pots which the crow wants to overflow}
Output Specification: Minimum number of stones required to make K pots overflow in worst case. Or -1 if input is invalid
Example: Let say there are two pots pot 1 has 0 value of 5 , 01= 5 pot 2 has 0 value of 58, 02= 58 Let say crow wants to make one of the pot to overflow. If he know which pot has what 0-value he would simple search for 5 stones and put then in pot 1 to make it overflow. But in real case he doesn't know which pot has what 0-value so just 5 stones may not always work. However he does know that one pot has 0-value S and other has 58. So even in worst case he can make one of the pot overflow just by using 10 stones. He would put 5 stones in one pot if it doesn't overflow he would try the remaining 5 in the other pot which would definitely overflow because one of the pot has 0-value of 5. So the answer for above question is minimum 10 stones even in worst case. Input : Input 1= {5,58} Input 2= 2 Input 3= 1 Output : 10| Report Duplicate | Flag | PURGE
Amazon Software Engineer - 0of 0 votes
AnswersGiven an array of ints, return a string identifying the range of numbers
- tbag March 31, 2015 in United States
Example
Input arr - [0 1 2 7 21 22 1098 1099]
Output - "0-2,7,21-22,1098-1099"| Report Duplicate | Flag | PURGE
Amazon Software Engineer Algorithm