Amazon Interview Questions
- 2of 2 votes
AnswersGiven an array of integers find the element for which the sum of left = sum of right. example -1 100 1 98 1 should return index of 1 i.e 2
Answer: First told him about Brute Force approach and then told him if we can iterate once and get the total sum
- Mumbaiya_Chori January 19, 2015 in India for Machine learningint findIndex(A){ int sum =0; for(int i =0;i<A.lenght;i++) { sum+= A[i]; } int lSum=0; for(int i=0;i<A.length;i++) { int rsum = sum - lsum-A[i]; if(lsum==rsum) return i; lsum += A[i]; } return -1; }
| Report Duplicate | Flag | PURGE
Amazon SDE1 Algorithm - 0of 0 votes
AnswersGiven a string having a number:
- sprateek1990 January 19, 2015 in United States
"625626628"
Here the substrings are in consecutive order except for 1 substring which is missing. Find the missing substring.
Test cases:
"1235678" -> 4 is missing
"9979981000" -> 999 is missing
"624625627" -> 626 is missing| Report Duplicate | Flag | PURGE
Amazon SDE1 - 0of 0 votes
AnswersYou are given a series like this:
- amusing January 16, 2015 in United States
(1,2)
(2,3)
(5,6)
(2,9)
Every element in this series is a pair(u,v) which means that there is a connection between (u,v).
Output group of elements:
For instance, if you look at the above series, the output will be:
[1,2,9], [5,6]| Report Duplicate | Flag | PURGE
Amazon Intern Algorithm - 1of 1 vote
AnswersDesign a TinyURL like Service.
- R@M3$H.N January 16, 2015 in India| Report Duplicate | Flag | PURGE
Amazon SDE-2 Algorithm Data Structures Problem Solving System Design - -1of 1 vote
AnswersDesign a site similar to junglee.com. Assume you are given a crawler, design a distributed system , what ds will you use , some basic api’s etc.
- sh January 12, 2015 in India| Report Duplicate | Flag | PURGE
Amazon SDE-2 System Design - 0of 0 votes
AnswerGive an architecture diagram with all entities and relationships of a multi user wysiwyg editor . basically a web interface to multiple authors who can edit and store their docs . multiple ppl should be able to save it at once . also ownership should be present for documents
- sh January 12, 2015 in India| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer System Design - 0of 0 votes
AnswersWrite a code to find if a link list is palindrome . Linklist consists variable string at each node. for eg
- abhi January 12, 2015 in India
a->bcd->ef->g->f->ed->c->ba
The above given linklist is palindrome and func shd return - True| Report Duplicate | Flag | PURGE
Amazon SDE-2 Algorithm - 1of 1 vote
AnswersWrite a program to reverse contents of a file in place..for example if file has "abcde" after executing program the contents should be "edcba". The program should be efficient.. You can use fwrite & fread apis...
- sandeep.bvb January 10, 2015 in United States
I wrote using fread and fwrite, by reading 1 char at a time and replacing with one at the other end.. He seemed not happy as the I/O was high...| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer C# - 1of 1 vote
AnswersPrint all subset of a given set which sums up to ZERO
- apurohit.in January 09, 2015 in India
{8,3,5,1,-4,-8}
so ans will be : {8,-8}
{3,5,-8}
{3,1,-4}
size of set can be upto 50 but elemet of set can be as big as 18 digit number| Report Duplicate | Flag | PURGE
Amazon Dev Lead Dev Lead Algorithm - 0of 0 votes
AnswersHi ,
- apurohit.in January 09, 2015 in India
Given a set of number eg {5,3,1,8, -8,-4}
Print all subset which will sum up to ZERO
for eg {3,1,-4} {5,3,-8}, {8,-8}
Note : size of subset can be max 100 and element can be very big like 13 or 14 digit number| Report Duplicate | Flag | PURGE
Amazon Dev Lead Dev Lead Algorithm - 0of 0 votes
AnswersImagine a large city like Los Angeles. Suppose someone shows up at location A, then N minutes later at location B. Design a function that approximates the probability they passed a Starbucks.
- NeutrinoPlus January 08, 2015 in United States| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm - 3of 3 votes
AnswersHow can you design a data structure that can do the following operations in O(1) time:
- Masumbuet December 29, 2014 in United States for International expansion
Insert, Delete, Search, Max which returns the maximum number
I know delete, search and insert can be done O(1) time in a hashmap with a proper hash function. But not sure Max is even possible in O(1) with the presence of delete operation?| Report Duplicate | Flag | PURGE
Amazon SDE1 Data Structures - 0of 2 votes
AnswersYou have given a mathematical expression in string format.
- dgchanchal December 24, 2014 in India for DSV QA team
Example: "3+12*3-4/7"
You need to write function which will return final result of the given expression. Don't use Expression Tree and start scanning from left to write.
It should be bug free.| Report Duplicate | Flag | PURGE
Amazon SDE1 Algorithm - -1of 1 vote
Answersyou have a sparse matrix with negative values almost 100 times the positive value. How will you retriev these negative values.
- Mumbaiya_Chori December 23, 2014 in India for Machine Learning
The interviewer was expecting something else other than just negative values.
He said look at it as a table where each seller has negative values for products he doesnt sell. He just wanted a subset of maybe all the negative values.| Report Duplicate | Flag | PURGE
Amazon - 1of 1 vote
AnswersYou are given a Matrix of 0's and 1's. An element at (i,j) is connected to another element at (i+-1, j+-1) if both of them are 1. Find the number of clusters formed by this.
- Mumbaiya_Chori December 22, 2014 in India for Machine learning
Answer: use dfs or bfs to traverse and then mark those positions with -1.| Report Duplicate | Flag | PURGE
Amazon - 0of 0 votes
AnswersSort two sorted Linked Lists.
- amostech December 20, 2014 in United States
Write your own implementation of structs / classes you might need to use.
Try to come up with the best time and space complexity.
I ran out of time after merging the two lists in O(n) time and O(1) space, but I am guessing he wanted to expand the solution to implement a merge sort algorithm for an unsorted Linked List.| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm - 0of 0 votes
Answerswrite boundary test cases for whether a linked list is circular linked list or not?
- kancharlaratna December 19, 2014 in United States| Report Duplicate | Flag | PURGE
Amazon Quality Assurance Engineer Testing - 0of 0 votes
AnswersWrite a java program logic to find whether list is circular
- kancharlaratna December 19, 2014 in United States
linked list or not?| Report Duplicate | Flag | PURGE
Amazon Quality Assurance Engineer Algorithm - 0of 0 votes
Answersgiven matrix like :
- Rahul Sharma December 18, 2014 in India
a b e d
b c f e
a b d d
….
find the longest path of consecutive alphabets given a starting alphabet. You can move in all 8 directions. for eg. a->b(right)->c(down)->d(diagnal down)… len = 4 , find max such len| Report Duplicate | Flag | PURGE
Amazon SDET Coding - -1of 5 votes
Answers20
- yingsun1228 December 17, 2014 in India
/ \
8 22
/ \ / \
5 3 4 25
/ \
10 14
traverse this binary tree vertically and its output will be
5
8 10
20 3 4
22 14
25| Report Duplicate | Flag | PURGE
Amazon Developer Program Engineer - 0of 0 votes
AnswersImplement the divide of two integers without using the divide operator.
- JSDUDE December 12, 2014 in United States for AWS Infrastructure Planning, Analysis and Optimization
After implementing the O(n) algorithm to subtract the divisor from the divider, he asked me to implement a better algorithm.
I started working towards bit manipulation, but ran out of time.
He also hinted that I could have used binary search. Not sure how though.| Report Duplicate | Flag | PURGE
Amazon SDE-2 Math & Computation - 0of 0 votes
AnswerGiven a stack of magazines create an anonymous love note (pick words or alphabets from the magazine and create the note)...
- JSDUDE December 12, 2014 in United States for AWS Infrastructure Planning, Analysis and Optimization
He gave me the choice of handling words or alphabets
Assume you have a scanned copy of the magazine as a string.
Once I implemented both words and alphabets, he asked me to scale it to mass production and maximize the throughput of a fulfillment center handling this| Report Duplicate | Flag | PURGE
Amazon SDE-2 Algorithm - 2of 2 votes
AnswersDesign a robot that will take your order and make sandwiches for you.
- JSDUDE December 12, 2014 in United States for AWS Infrastructure Planning, Analysis and Optimization
Once I was done with this, I was supposed to extend it to have multiple robots doing this job like an assembly line handling multiple sandwiches and other edible items
Once I handled that, he asked me to create a web service for this that will handle online ordering. He also wanted me to implement fulfillment centers| Report Duplicate | Flag | PURGE
Amazon SDE-2 Object Oriented Design - 0of 0 votes
AnswersGiven a array of positive integers, you have to find the smallest positive integer that can not be formed from the sum of numbers from array.
- hacker123 December 07, 2014 in India| Report Duplicate | Flag | PURGE
Amazon SDE-2 Arrays - 0of 0 votes
AnswersDescribe Class diagram of a Card Game like Poker. What classes to be used. How to deal and shuffle the cards in cards class
- Amazon December 05, 2014 in United States| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer - 1of 1 vote
AnswersGive you a list of Modules of Dependencies,
- wyu277 December 04, 2014 in United States
A --> B,C
B --> D,E,F
D --> F
And please return back a correct build order of Module (input)| Report Duplicate | Flag | PURGE
Amazon SDE1 Algorithm