Amazon Interview Questions
- 0of 0 votes
AnswersIn an incoming stream of +ve integers, return true if 2 numbers with sum equal to 10 has occurred till now.
- ganesh.eng2015 July 24, 2016 in India
How to handle stream of numbers| Report Duplicate | Flag | PURGE
Amazon SDE1 Algorithm - 0of 0 votes
AnswersGiven an array,find all valid ip-address form this array.
- ganesh.eng2015 July 24, 2016 in India| Report Duplicate | Flag | PURGE
Amazon SDE1 Algorithm - 0of 0 votes
AnswersAn unsorted array is given . Find the no of greater elements on right side on current element in array. Find this for every element of array Expected time complexity is lesser then O(n^2)
- knocks July 24, 2016 in United States| Report Duplicate | Flag | PURGE
Amazon Software Developer Algorithm - 0of 0 votes
AnswersA monotonically increasing function F(X) exists. For a given no N , find the value of X when F(X) = N.
- knocks July 24, 2016 in India| Report Duplicate | Flag | PURGE
Amazon Software Developer 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 - 3of 3 votes
AnswersA program stores total order numbers arrived at different time. For example, at 1.15 pm the program got 15 order, at 1.30 pm, the program got 20 order and so on.Now we need to design the data structure so that we can query the total orders we got in a time range efficiently. For this example, we can query as How many orders we have got between 1 and 2 pm? Ans will be 15+ 20 = 35
- gadha July 21, 2016 in India| Report Duplicate | Flag | PURGE
Amazon SDE-2 Data Structures Java Object Oriented Design - -1of 1 vote
AnswersThis is a interview question which needs to be optimized for time.
- Abhi July 19, 2016 in India
Suppose you have a 2 dimensional Array and you have a String say "Amazon" inside the Array such that the individual characters can be present from Left to Right, Right to Left, Top to down and down to up.
I will explain with example :
char[][] a = {
{B,B,A,B,B,N},
{B,B,M,B,B,O},
{B,B,A,B,B,Z},
{N,O,Z,B,B,A},
{B,B,B,B,B,M},
{B,B,B,B,B,A}
};
The above Array has two Amazon Strings. You need to return the count of number of such strings present.| Report Duplicate | Flag | PURGE
Amazon SDE-2 - 0of 0 votes
AnswersMilly and Pranjul are playing a game in which Pranjul will give an index of a chocolate.
- claud.qualityinfo July 14, 2016 in India
Then, Milly has to tell him the box number in which that chocolate is in. There are N
such boxes and Ci chocolates are there in ith the box. Description of index is given below
:
Suppose there are A1, A2 … AN chocolates in 1st, 2nd… Nth boxes respectively. So,
indexing of chocolates in 1st box will be from 1 to A1, similarly in 2nd box indexing will be
A1 + 1 to A2 … and indexing in Nth box will be from AN-1 + 1 to AN.
Milly is blind folded so she can’t see the boxes. You are required to help her.
Input
First line will contain N (No. of boxes). Next line will contain N space separated
integers denoting Ci, the number of chocolates in ith box.
Next line will contain Q (No. of times Pranjul will ask her). Then each next Q lines
will contain the asked index I.
Output
For every query, print in a new line : the box number in which that index of
chocolate is in.
Constraints
1 ≤ N, Q ≤ 105
1 ≤ Ci ≤ 10
1 ≤ Σ Ci ≤ 106
1 ≤ I ≤ Σ Ci| Report Duplicate | Flag | PURGE
Amazon SDE-2 - 0of 0 votes
Answers1. If server is slow then tell me what are all the possible ways to trouble shoot to find why the server is slow.
- Srinivas July 14, 2016 in India| Report Duplicate | Flag | PURGE
Amazon Applications Developer - 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
AnswersFind out the longest repeated common sub-string(overlapped) in a string.
- rasmiranjanbabu July 05, 2016 in United States
For example:- mystr = banana # The "ana" is the common overlapped sub-string is been used 2 times.| Report Duplicate | Flag | PURGE
Amazon Software Analyst Algorithm - 0of 0 votes
AnswersGiven input format, The first line has the number of employees of a company Z. The next two lines have employees to perform certain operations on. The first employee of the fourth line can be assumed to be the ceo of the company. Each line from then on has the format Employee X Employee Y where X manages Y. (and hence Y forms the child for X).
- thisandthat July 04, 2016 in India
input:
6
Rajesh
Ravi
//Tree Starts here
Ram Raj
Ram Goku
Raj Rajesh
Raj Richa
Richa Ravi
Its known that each person in the company can directly line manage a maximum of 2 other employees.
For the two employees in the first two lines, find the lowest common manager.
How to construct this tree in java to eventually do an lca?| Report Duplicate | Flag | PURGE
Amazon SDE-2 Data Structures - 2of 2 votes
AnswersYou want to design a Cab system which will show you nearest 5 taxis.
- Shanky.Q3 July 04, 2016 in United States
Each taxi will continuously emit (x,y) coordinates.
You need to print the nearest 5 taxis from (p,q).| Report Duplicate | Flag | PURGE
Amazon SDE1 Algorithm - 0of 0 votes
AnswersGiven an arithmetic expression, write a program to find the value of the expression. Only binary operations that are allowed are +,-,*,/. Also assume that all parentheses are well matched.
- khushbuparakh July 03, 2016 in India
Note that the use of eval() is forbidden
Input format :There is a single positive integer T on the first line of input . It stands for the number of expressions to follow.
Next T lines followed by expression
Output format : For each expression print the value of expression
3
19 + 12 / 4 - ((4 - 7) * 3 / 1)
1 + (2 - 3) * 4 + 5 - 6 * 8 - (18 * 12 * 13) - (11 / (5 + 2 + 4))
((2 + 4) / 3 - 2 + 1)
Output:
31
-2855
1| Report Duplicate | Flag | PURGE
Amazon Android Engineer Math & Computation - 0of 0 votes
AnswersDesign for online card game say like poker or any other game. The classes etc..
- SS June 30, 2016 in India| Report Duplicate | Flag | PURGE
Amazon SDE-2 design - 0of 0 votes
AnswersDesign Food Panda or online food ordering system.
- SS June 30, 2016 in India| Report Duplicate | Flag | PURGE
Amazon SDE-2 design - 1of 1 vote
AnswersChess Knight Problem: - It deals with a knight piece on a chess board. You are given two inputs: starting location and ending location. The goal is to then calculate and print the shortest path that the knight can take to get to the target location.
- SS June 30, 2016 in India| Report Duplicate | Flag | PURGE
Amazon SDE-2 Algorithm - 0of 0 votes
AnswersWrite a unix command to display the every character in the word "AMAZON" in new line.
- Srinivas June 29, 2016 in India
Ex : Input - AMAZON
output: A
M
A
Z
O
N| Report Duplicate | Flag | PURGE
Amazon Development Support Engineer - 0of 0 votes
AnswersWrite a algorithm to find the unsold item in the Amazon
- vijaybihari1 June 20, 2016 in United States| Report Duplicate | Flag | PURGE
Amazon Data Scientist - 0of 0 votes
AnswersA planner wants to deign a city. A city having n points of interest and marked them from 0 - (n-1). Need to write two API:
- Harsh123 June 12, 2016 in India
public void buildRoad(int a, int b); // build road directly between a and b.
public boolean isRoadExist(int a, int b); // Check if there is any road connectivity exist between a & b (either directly or indirectly) then return TRUE else FALSE.
The solution should be in O(log n). You can first try in O(n).| Report Duplicate | Flag | PURGE
Amazon SDE-2 Problem Solving - 0of 2 votes
AnswersWrite all jumbled number which is >0 && <N, where N is provided by the user.
- Harsh123 June 12, 2016 in India
A jumbled number is a number whose neighbour digit (either left or right) max differ by 1 value.
e.g.:
8987 is a jumbled number.
13 is not a jumbled number.
123456 is a jumbled number.
287 is not jumbled number.| Report Duplicate | Flag | PURGE
Amazon SDE-2 Problem Solving - 0of 0 votes
AnswersWhat is a stack? What operations can be performed on it?
- Enigma8ic June 07, 2016 in United States
Implement a stack data structure.| Report Duplicate | Flag | PURGE
Amazon SDET Data Structures - 0of 0 votes
AnswersImplement a datastructure with the following APIs
- Enigma8ic June 07, 2016 in United States
void add(int) - 3,12,5,6,1
int getMin() - 1,3,5,6,12| Report Duplicate | Flag | PURGE
Amazon SDET Data Structures - 3of 3 votes
AnswersGiven a file (which can be considered as a String with comma delimiter for the complexity of the question) of usernames and a value k, find top k usernames (with number of logins) who logged into the system the most.
- sambenison66 June 05, 2016 in United States
For example -
Input:
User (String) = user1, user4, user2, user1, user3, user1, user2, user3
k (int) = 2
Output:
user1 (3)
user2 (2)
user3 (2)
- Both user2 and user3 should be included since both has same number of logins
Write a java method to find the output with best time and space complexity.| Report Duplicate | Flag | PURGE
Amazon Software Engineer in Test Java