Amazon Interview Questions
- 0of 0 votes
AnswersYou are given an array, you have to replace each element of the array with product of the rest element. Example: {1,2,3}==> {6,3,2}
- neelabhsingh February 20, 2015 in India for Hyderabad| Report Duplicate | Flag | PURGE
Amazon SDE1 Algorithm - 0of 0 votes
AnswersSuppose you have an array with infinite numbers, which is sorted and there may be duplicates. Find the occurrence of a number.
- MM February 20, 2015 in United States| Report Duplicate | Flag | PURGE
Amazon SDE1 - 0of 0 votes
AnswersHow will implement an auto complete feature? Eg: if you type clo it shows clothes etc
- MM February 20, 2015 in United States| Report Duplicate | Flag | PURGE
Amazon SDE1 - 0of 0 votes
AnswersSuppose there are 2 streams, which has infinite value and write a method that returns a stream that would be a combination of both the streams in a sorted form
- MM February 20, 2015 in United States| Report Duplicate | Flag | PURGE
Amazon SDE1 - 0of 0 votes
AnswersWrite printf method.
- Nitin Gupta February 17, 2015 in India| Report Duplicate | Flag | PURGE
Amazon SDE1 Algorithm - 1of 1 vote
AnswersWhich is best Merge Sort or QuickSort?
- Nitin Gupta February 17, 2015 in India
Why and How?| Report Duplicate | Flag | PURGE
Amazon SDE1 Algorithm - 0of 0 votes
Answers(Variant of Children-Sum Problem better than O(n^2))
- Rahul Sharma February 08, 2015 in India
Given a tree, implement a function which replaces a node’s value with the sum of all its childrens’ value, considering only those children whose value is less than than the main node’s value.
Eg: input = 60->50->80->40 , output = 90->40->40->0| Report Duplicate | Flag | PURGE
Amazon SDE1 Coding - 0of 0 votes
AnswersFind if a given number can be expressed in the form of p^q, where p and q are integers
- xyz_coder February 06, 2015 in United States| Report Duplicate | Flag | PURGE
Amazon SDE1 Algorithm Coding - 0of 0 votes
AnswersFind all palindromes in a given string. Single letters are also considered as palindromes.
- xyz_coder February 06, 2015 in United States| Report Duplicate | Flag | PURGE
Amazon SDE1 Algorithm Coding - 1of 1 vote
AnswersGiven a number A, find the smallest number which has only 1s and 0s as its digits which divisible by the number A. For example: if the given number A is 4, the smallest number with 1s and 0s is which is divisible by 4 is 100.
- xyz_coder February 06, 2015 in United States| Report Duplicate | Flag | PURGE
Amazon SDE1 Algorithm Arrays Coding - 2of 2 votes
Answers{{
- skc25pma February 02, 2015 in India
There are 3 machines M1, M2 and M3. Each machine is 90% full of its capacity with integers. Now you have to sort all the integers combined and then store the first 1/3rd in M1, second 1/3rd in M2 and last 1/3rd in M3.
Your objective is to minimize the number of sort operations and number of data transfer operations.
Each sort operation/data transfer operation is counted as 1 irrespective of the count of values that are being sorted/transferred.
}}| Report Duplicate | Flag | PURGE
Amazon SDE1 Algorithm Coding Sorting - 0of 0 votes
AnswersEntry in the log file is like this:
- openhealth2014 February 01, 2015 in United States
User 1 visited Page 4
User 3 visited Page 2
User 7 visited Page 9
.
.
.
Design an efficient data structure which supports queries like the following:
Which page was visited by exactly 2 users in day?
Which page was visited by only one user exactly 2 times in a day?
Which page was visited by ‘User 3? more than 5 times in a day?| Report Duplicate | Flag | PURGE
Amazon SDE1 Object Oriented Design - 0of 0 votes
AnswerDesign a system for finding the costliest element always whenever we pick up an element from a box.(concept of Max Heap)
- openhealth2014 February 01, 2015 in United States| Report Duplicate | Flag | PURGE
Amazon SDE1 Object Oriented Design - 0of 0 votes
AnswersEntry in the log file is like this:
- openhealth2014 February 01, 2015 in United States
User 1 visited Page 4
User 3 visited Page 2
User 7 visited Page 9
.
.
.
Design an efficient data structure which supports queries like the following:
Which page was visited by exactly 2 users in day?
Which page was visited by only one user exactly 2 times in a day?
Which page was visited by ‘User 3? more than 5 times in a day?| Report Duplicate | Flag | PURGE
Amazon SDE1 Object Oriented Design - 2of 2 votes
AnswersGiven N scientists and K black holes, each scientist can query on radius, size and temperature of a black hole, what data structure would you use?
- openhealth2014 February 01, 2015 in United States
Following queries are important.
Which scientist had queried on which black hole.
What were the queries made by that scientist.| Report Duplicate | Flag | PURGE
Amazon SDE1 Object Oriented Design - 0of 0 votes
AnswersIn a tennis tournament of N players every player plays with every other player.
- openhealth2014 February 01, 2015 in United States
The following condition always hold-
If player P1 has won the match with P2 and player P2 has won from P3, then Player P1 has also defeated P3.
Find winner of tournament in O(N) time and O(1) space. Find rank of players in O(NlogN) time.| Report Duplicate | Flag | PURGE
Amazon SDE1 Object Oriented Design - 1of 1 vote
AnswersWrite code for scheduling algorithms for such a cab services provided you have a list of future bookings, and list of cabs in your fleet.
- openhealth2014 February 01, 2015 in United States| Report Duplicate | Flag | PURGE
Amazon SDE1 Object Oriented Design - 0of 0 votes
AnswersIn an auctioning system, the bidder with the highest bid wins but charged at kth highest price. Develop a system for it. Solved it using a hashmap. Was asked to write a code for the same.
- openhealth2014 February 01, 2015 in United States| Report Duplicate | Flag | PURGE
Amazon SDE1 Object Oriented Design - 0of 0 votes
AnswersDesign a system which would make a schedule for a user to complete a book in given number of days. A pre condition is that the schedule for every day should end at the end of some chapter.
- openhealth2014 February 01, 2015 in United States
Ex – 3 chapter with 10 pages each and user has to complete this book in 2 days, then the schedule should be either be 2 chapters on first day and 1 chapter on second or 1 chapter on first day and 2 chapters on second. (code)| Report Duplicate | Flag | PURGE
Amazon SDE1 Object Oriented Design - 1of 1 vote
AnswersImplement DFS
- Mumbaiya_Chori January 19, 2015 in India for Machine learning
After I implemented this, I was told to implement it without recursion. He told me to write pseudo code. I wrote it using stacks.| Report Duplicate | Flag | PURGE
Amazon SDE1 - 1of 1 vote
AnswersGiven a matrix (0,0 is to the botto9m left like co-ordinate system)of 0s and 1s and two co-ordinates find if there is a path between them, Also you can only travel via 1s and you can only go up or right.
- Mumbaiya_Chori January 19, 2015 in India for Machine learning
Answer: Backtracking algorithm| Report Duplicate | Flag | PURGE
Amazon SDE1 - 0of 0 votes
Answersgiven K sorted arrays merge them
- Mumbaiya_Chori January 19, 2015 in India for Machine learning
Answer: Told him how to do using merge of merge sort. He wanted me to do another approach I googled later you can use min heap for it.| Report Duplicate | Flag | PURGE
Amazon SDE1 - 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 - 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
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 - -4of 4 votes
AnswersShorten a List of Strings.
- wyu277 December 04, 2014 in United States| Report Duplicate | Flag | PURGE
Amazon SDE1 Algorithm - 0of 2 votes
AnswersDesign a Black-Jack poker game
- wyu277 December 04, 2014 in United States| Report Duplicate | Flag | PURGE
Amazon SDE1 Object Oriented Design - 4of 4 votes
AnswersGive an 2d-characters Grid, char[][] A, and a dictionary, List<String> dict. Search all possible words in the 2d-Grid.
- wyu277 December 04, 2014 in United States| Report Duplicate | Flag | PURGE
Amazon SDE1 Algorithm